不同浏览器css引入外部字体的方式


/**
 * 字体后缀和浏览器有关,如下所示
 * .TTF或.OTF,适用于Firefox 3.5、Safari、Opera 
 * .EOT,适用于Internet Explorer 4.0+ 
 * .SVG,适用于Chrome、IPhone 
 * 比如:
 */
@font-face {
    font-family: 'MyFont';/*定义字体名称*/
    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;
}

/**
 * 使用字体
 */
body {
    font-family: 'MyFont', serif;
}

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM