在浏览网页时,由于客户端没有安装某些特殊字体,导致网页文字无法按设计正常显示,这时我们可以使用服务器字体来避免这种现象的发送

语法

@font-face {
  /* 自定义字体名称 */
  font-family: MyFont;
  /* 指定字体位置 */
  /* 先找本地是否存在,存在则使用本地字体 */
  src: local("myFont"),
    
/* 这里是两种后缀的字体的使用方法 */
    
url("myFont.ttf")format("truetype"),
     url("myFont.otf")format("opentype")
;
}

使用

#div{
  font-family: MyFont;
}

 

相关文章:

  • 2022-01-19
  • 2022-12-23
  • 2021-09-03
  • 2022-03-04
  • 2022-12-23
  • 2022-01-12
猜你喜欢
  • 2021-07-08
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-13
  • 2021-10-14
相关资源
相似解决方案