2011-07-17 56 views
1

我打算在我的网站上使用Google网络字体。
我的网站有很多页面,但很少有CSS文件。
- =>有什么办法可以在CSS文件中添加这个标签[因为我不想编辑所有的HTML文件]?Google Web字体

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

或者我需要在每个HTML页面的头部添加上面的行?

回答

4

没错,@import谷歌的字体在 - jsfiddle example

在你的CSS文件的顶部将这个

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

然后,引用它像正常

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

非常感谢!它的工作原理 – Sourav

+2

值得注意的是@import会影响性能,应该避免,请参阅https://developers.google.com/speed/docs/best-practices/rtt#AvoidCssImport和http://developer.yahoo.com/ performance/rules.html#csslink获取更多信息。 – Bell

0

添加标签,怎么样?请更好地解释你自己。

在你能做到这一点的HTML ...

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

如果这是你在问什么?

+0

我更新题 ! – Sourav