css引入外部字体

css引入外部字体

@font-face{
    font-family: 'YaHei Consolas Hybrid';
    src : url('../fonts/yaheiconsolashybrid.ttf');
}

body{
    font-family: 'YaHei Consolas Hybrid';
    font-size: 16px;
    background: url(../img/bgContent.png) repeat;
}

不同浏览器字体的格式有差别

字体后缀和浏览器有关,如下所示
* .TTF.OTF,适用于Firefox 3.5SafariOpera 
* .EOT,适用于Internet Explorer 4.0+ 
* .SVG,适用于ChromeIPhone 
比如:
@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;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章