【问题标题】:Google Web Fonts谷歌网络字体
【发布时间】:2018-11-22 21:32:02
【问题描述】:

我打算在我的网站上使用 Google 网络字体。
我的网站有很多页面,但只有几个 CSS 文件。
-=> 有没有办法在 CSS 文件中添加这个标签(因为我不想编辑所有HTML 文件)?

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

或者我需要在每个 HTML 页面的 head 部分中添加上述行吗?

【问题讨论】:

    标签: html css fonts google-font-api


    【解决方案1】:

    是的,@import 中的 google 字体 - jsfiddle example

    将其放在 CSS 文件的顶部

    @import url('http://fonts.googleapis.com/css?family=Droid+Sans');
    

    然后,像往常一样引用它

    h1 { font-family: 'Droid Sans', arial, serif; font-size:24pt;}
    

    【讨论】:

    【解决方案2】:

    添加标签,如何?请更好地解释自己。

    在 HTML 中你可以这样做……

    <style type="text/css" media="screen">
      h1 { font-family: 'Droid Sans', arial, serif; }
    </style>
    

    如果这就是你要问的?

    【讨论】:

      猜你喜欢
      • 2011-11-18
      • 2012-02-16
      • 2011-07-08
      • 2012-10-04
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-14
      • 1970-01-01
      相关资源
      最近更新 更多