• css3学习总结6--CSS3字体


    使用自己需要的字体

    在新的 @font-face 规则中,您必须首先定义字体的名称(比如 myFirstFont),然后指向该字体文件。

    如需为 HTML 元素使用字体,请通过 font-family 属性来引用字体的名称 (myFirstFont):

    实例

    <style>
    @font-face
    {
      font-family: myFirstFont;
      src:   url('singlemalta-webfont.ttf'),
          url('singlemalta-webfont.eot'); /* IE9+ */
    }
     
    div
    {
      font-family:myFirstFont;
    }
    </style>
    

     

    使用粗体字体

    您必须为粗体文本添加另一个包含描述符的 @font-face:

    示例:

    @font-face
    {
      font-family: myFirstFont;
      src: url('singlemalta-webfont.ttf'),
          url('singlemalta-webfont.eot'); /* IE9+ */
      font-weight:bold;
    }
    

      

     

    下面的表格列出了能够在 @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"。
     
  • 相关阅读:
    opencv4.6.0 + rtx2070 + ubuntu16.04 install tutorial AHU
    AcWing 1321. 取石子
    POJ1704 Georgia and Bob(阶梯博弈)
    HDU2188 悼念512汶川大地震遇难同胞——选拔志愿者
    HDU 1730 Northcott Game
    HDU 1846 Brave Game
    HDU 2176 取(m堆)石子游戏
    HDU 1850 Being a Good Boy in Spring Festival
    AcWing 1319. 移棋子游戏
    HDU 1847 Good Luck in CET4 Everybody!
  • 原文地址:https://www.cnblogs.com/shuiche/p/4624474.html
Copyright © 2020-2023  润新知