CSS3 @font-face属性

属性定义及使用说明

@font-face规则,网页设计师再也不必使用的"web-safe"的字体之一。

字体的名称,font - face规则:

  • font-family: myFirstFont;

字体文件包含在您的服务器上的某个地方,参考CSS:

  • src: url('Sansation_Light.ttf')

如果字体文件是在不同的位置,请使用完整的URL:

  • src: url('http://www.w3cschool.css/css3/Sansation_Light.ttf')
@font-face
{
font-family: myFirstFont;
src: url('Sansation_Bold.ttf'),
     url('Sansation_Bold.eot'); /* IE9+ */
font-weight:bold;
}



CSS3 字体描述符

下面的表格列出了能够在 @font-face 规则中定义的所有字体描述符:

描述符描述
font-family name 必需。规定字体的名称。
src URL 必需。定义字体文件的 URL。
font-stretch
  • normal
  • condensed
  • ultra-condensed
  • extra-condensed
  • semi-condensed
  • expanded
  • semi-expanded
  • extra-expanded
  • ultra-expanded
可选。定义如何拉伸字体。默认是 "normal"。
font-style
  • ormal
  • italic
  • oblique
可选。定义字体的样式。默认是 "normal"。
font-weight
  • normal
  • bold
  • 100
  • 200
  • 300
  • 400
  • 500
  • 600
  • 700
  • 800
  • 900
可选。定义字体的粗细。默认是 "normal"。
unicode-range unicode-range 可选。定义字体支持的 UNICODE 字符范围。默认是 "U+0-10FFFF"。
原文地址:https://www.cnblogs.com/izengbin/p/7118007.html