怎样在网页中嵌入字体

通常获取要使用字体的三种文件格式,确保能在主流浏览器中都能正常显示该字体。
.TTF或.OTF,适用于Firefox 3.5、Safari、Opera
.EOT,适用于Internet Explorer 4.0+
.SVG,适用于Chrome、IPhone

我这里推荐一个在线字体转换服务的网站,可以自动帮你把字体转换为需要的三种格式

第一步:http://www.fontsquirrel.com/ 进入网站选择 WEBFONT GENERATOR 进入字体转换页面

第二步: 点击 add fonts 选择你想要转换的字体并上传

第三步:网站会自动生成一个kit 包,解压后自行修改一下就可以使用了哦,主要是要注意一下字体声明的css

@font-face {
    font-family: 'whitneycondensedmedium';
    src: url('whitneycondensed-medium-webfont.eot');
    src: url('whitneycondensed-medium-webfont.eot?#iefix') format('embedded-opentype'),
         url('whitneycondensed-medium-webfont.woff') format('woff'),
         url('whitneycondensed-medium-webfont.ttf') format('truetype'),
         url('whitneycondensed-medium-webfont.svg#whitneycondensedmedium') format('svg');
    font-weight: normal;
    font-style: normal;

}

如此就完成了,大家不妨来试试吧~

赞 (0)
分享到:更多 ()

评论 0

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址