码迷,mamicode.com
首页 > Web开发 > 详细

css引入外部字体

时间:2018-06-17 19:54:00      阅读:246      评论:0      收藏:0      [点我收藏+]

标签:inter   weight   opera   ref   attr   font-face   nts   explore   ack   

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.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;
}

css引入外部字体

标签:inter   weight   opera   ref   attr   font-face   nts   explore   ack   

原文地址:https://www.cnblogs.com/my2018/p/9193480.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!