@font-face {
font-family: SketchRockwell; /*這里是說明調用來的字體名字*/
src: url(‘SketchRockwell.ttf’); /*這里是字體文件路徑*/
}
.my_CSS3_class {
font-family: SketchRockwell; /*這里設置某參數的字體值,在這里是“my_CSS3_class”調用了你剛才聲明的字體值"SketchRockwell"*/
font-size: 3.2em; /*這里是字體大小*/
}
字體后綴和瀏覽器有關,如下所示
* .TTF或.OTF,適用於Firefox 3.5、Safari、Opera
* .EOT,適用於Internet Explorer 4.0+
* .SVG,適用於Chrome、IPhone
比如:
@font-face {
font-family: 'HansHandItalic';
src: url('fonts/hanshand-webfont.eot');
src: url('fonts/hanshand-webfont.eot?#iefix') format('embedded-opentype'),
url('fonts/hanshand-webfont.woff') format('woff'),
url('fonts/hanshand-webfont.ttf') format('truetype'),
url('fonts/hanshand-webfont.svg#webfont34M5alKg') format('svg');
font-weight: normal;
font-style: normal;
}
