Welcome

首页 / 脚本样式 / CSS / 网页使用Google Font API(字体)的方法

在网页设计里,字体的显示是个问题。最普遍用的是宋体,但是宋体在 Win 7 下的表现真的很难看。雅黑端庄一些,但是随着字体大小,感觉汉字的大小也会有区别。小站现在用的字体是是宋体 + Arial/Georgia,因为习惯了也没多在意,其实对于英文字体有其它更好的选择。
比如 Bitter 字体,用来做标题倒是不错:
复制代码 代码如下:
<div style="text-align:center; font-size:24px; font-family:Bitter;">Welcome To NowaMagic.net</div>

CSS 怎么调用 Bitter 字体?
复制代码 代码如下:
@font-face {
  font-family: "Bitter";
  font-style: normal;
  font-weight: 400;
  src: local("Bitter-Regular"), url(http://themes.googleusercontent.com/static/fonts/bitter/v4/s9gJB935qk_YG8d-lnTdvA.woff) format("woff");
}
@font-face {
  font-family: "Bitter";
  font-style: normal;
  font-weight: 700;
  src: local("Bitter-Bold"), url(http://themes.googleusercontent.com/static/fonts/bitter/v4/JGVZEP92dXgoQBG1CnQcfD8E0i7KZn-EPnyo3HZu7kw.woff) format("woff");
}

其实,这是 Google 推出的Google Font Directory和Google Font API两项服务,Google联合了众多的字体设计者为用户提供了多种漂亮的字体。具体可以参看以前写的一篇文章:《用Google Font API来丰富网页字体》。
这里仅仅抛砖引玉,国内实在太少网站用 Google Font API 了。