现在的位置: 首页 > 综合 > 正文

使用Google Font API让网页的文字更漂亮

2011年12月05日 ⁄ 综合 ⁄ 共 659字 ⁄ 字号 评论关闭

Google在5月20日宣布推出Google Font DirectoryGoogle Font API两项服务。在Google Font Directory中,Google联合了众多的字体设计者为用户提供了多种漂亮的字体,但现在全部是英文字体,相信今后会有中文字体。Google Font API 和Google Font Directory是相辅相成的,用户正是通过Google Font API来使用Google Font Directory中的字体。

下面让我们看看如何使用Google Font API 。

1.在Google Font Directory查找字体

进入Google Font Directory选择合适的字体。点击选择的字体可以查看它在各种大小下的显示效果。

2.引用字体文件

由于这些字体在本地系统中不存在,所以必须在页面中引用它们的字体文件。这些文件托管在Google的云中,引用它们通过下面的方式。

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

3.使用字体

使用字体通过将html节点的font-family样式设置为上面引用的字体。

h1 { font-family: 'Reenie Beanie', arial, serif; }

最终效果

很炫吧,去尝试一下!

本文永久链接:http://www.cnblogs.com/lloydsheng/archive/2010/05/22/1741733.html

抱歉!评论已关闭.