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;
}
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章