---
title: "CSS3: @font-face"
author: "winzenghua"
date: "2011-01-12T15:27:00Z"
tags: []
slug: "css3-font-face"
draft: false
lastmod: "2011-01-12T15:27:00Z"
id: 947894
url: "https://java4gis.iteye.com/blog/947894"
---

想要制作一些很酷的头部效果并且不使用图片文件嘛？可以尝试一下 CSS3 里面的 @font-face。

代码如下：

```
@font-face {
	font-family: qianduanNet;
	src: url("SketchRockwell.ttf");
}

.fontFace{
	font-family: qianduanNet;
	font-size: 3.2em;
	letter-spacing: 1px;
	text-align: center;
}
```

但这需要你去下载字体，相对而言 [Google Font Directory](http://code.google.com/webfonts) 就方便太多了。只可惜目前不支持中文。

不过简单的中文用英文代替，大家都可以看得懂的。嘿嘿，因此在 [b3log](http://b3log-solo.googlecode.com/) 的新皮肤中头部使用到了[Google Font Directory](http://code.google.com/webfonts) 中的两中字体，实际效果图如下。

![google font, b3log](http://vanessa.b3log.org/datastore-file-access.do?oId=1294811638475)

你可以到 [Google Font Directory](http://code.google.com/webfonts) 上面选择你喜欢的字体，然后点击进入，选择 use this font, 相应的添加 link 和 CSS 就可以搞定了；

或者使用 [WebFont Loader](http://code.google.com/apis/webfonts/docs/webfont_loader.html "Google AJAX APIs - Google Code"), 它将为您提供更加多的使用方法。

本文是使用 [B3log Solo](http://b3log-solo.googlecode.com/) 从 [Vanessa](http://vanessa.b3log.org:80) 进行同步发布的

原文地址：[http://vanessa.b3log.org/css3-font-face](http://vanessa.b3log.org/css3-font-face)