【问题标题】:Google font not working谷歌字体不工作
【发布时间】:2017-06-08 19:18:44
【问题描述】:

我想在我的网站上使用 Lato light google 字体。

为每条指令添加了链接 herf=... 和字体系列标签,但它无法正常工作。

在我安装了 Lato 字体的笔记本电脑上,我看到实现了 Lato light font;但是,在我朋友的电脑和手机上,我没有看到 Lato 浅字体(我看到的是一些随机字体)

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en-us">
<head>
    <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet">
    <meta http-equiv="content-type" content="text/html; charset=utf-8" />



body {
font-family: 'Lato', sans-serif;
background-color: white;
font-weight: 300;
color: #595959; 
letter-spacing: 1.4px;

}

我不知道问题是什么——当我删除 font-family: 'Lato', sans-serif;在 body { 下方,我不再在我的计算机上看到 Lato 字体......所以它可以正常工作,但非常正确。

输入将不胜感激!!!

【问题讨论】:

  • 像这样使用重要的“font-family: 'Lato', sans-serif !important;”
  • 我将首先添加一个 doctype 声明,因为没有它,页面在技术上是无效的,这会使您的渲染模式有些不可预测。
  • 这里工作正常。检查这个小提琴jsfiddle.net/j1ajzo4p。为了更好地理解,我更改了一些元素。
  • 它的开头有 ttp://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" rel="nofollow" target="_blank">w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">。这是你的意思吗? @TiesonT。
  • @OmarFaruque 没用:/

标签: css fonts


【解决方案1】:

试试这个方法,我觉得效果很好

<link href="https://fonts.googleapis.com/css?family=Lato:100,300,400,700,900" rel="stylesheet">

【讨论】:

  • 能否提供使用时的url
  • 请将此行称为head部分fonts.googleapis.com/css?family=Lato:100,300,400,700,900" rel="stylesheet">
  • 然后通知我。
  • K 刚刚做到了。顺便说一句,我在最后添加了“/”。所以 rel="stylesheet" />
  • 我没有看到你在 head 部分中调用 google 字体的位置
【解决方案2】:

正确的 html 声明可以正常工作。您可以使用更新的 lato 字体链接

body {
	font-family: 'Lato', sans-serif;
    background-color: white;
    font-weight: 300;
    color: #595959; 
    letter-spacing: 1.4px;
}
<!Doctype html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">

  <head>
	<link href='http://fonts.googleapis.com/css?family=Lato' rel='stylesheet' type='text/css'>
  </head>

  <body>
	
    <p>I am paragraph</p>
  </body>

</html>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-04-08
    • 2015-05-14
    • 1970-01-01
    • 2015-09-28
    • 2011-04-11
    • 2015-09-24
    • 2015-04-10
    相关资源
    最近更新 更多