如何使用 Google Web Fonts?

来源:互联网 发布:淘宝详情页编辑 编辑:程序博客网 时间:2024/06/08 09:58
  1. 进入Google Web Fonts 主页:http://www.google.com/webfonts 点击“开始选择字体”;
  2. 从200+字体中选择想要的字体(可惜没有中文字体),选择“使用”;
  3. 设置你选择字体的样式和字符集;
  4. 把字体加到你的网站:
方法一:标准式:在head部分加入一串 link 样式,引入Google字库:;
方法二:@import 式:@import url(http://fonts.googleapis.com/css?family=Comfortaa|Rosario);
方法三:js引入:
WebFontConfig = {
google: { families: [ 'Comfortaa:latin', 'Rosario:latin' ] }
};
(function() {
var wf = document.createElement('script');
wf.src = ('https:' == document.location.protocol ? 'https' : 'http') +
'://http://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js';
wf.type = 'text/javascript';
wf.async = 'true';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(wf, s);

})();


了解更多

使用 Google Fonts 为网页添加美观字体
http://www.ibm.com/developerworks/cn/web/1505_zhangyan_googlefont/

0 0