|
1.在浏览器上使用服务器字体文件的字体用法
<style>
@font-face{
font-famliy : webfont; /*这里必须写作 webfont,表示服务器字体*/
src : url('font/字体文件1.otf') format("open type")
}
@font-face{
font-famliy : webfont; /*这里必须写作 webfont,表示服务器字体*/
font-style: italic; /*如果需要用斜体字,还要再定义一下@font-face*/
src : url('font/字体文件1.otf') format("open type")
}
h1{
font-family:webfont; /*这里也必须写作 webfont*/
}
可用的字体文件格式:
字体格式 字体属性
otf opentype
ttf truetype
eot embedded-opentype (仅IE支持)
</style>
2.在浏览器上使用客户端本地字体用法
例如本地的Arial字体,也可以是别的字体
@font-face{
font-family: Arial;
src: local('Arial');
}
h1{
font-family:Arial;
}
|