📜  CSS | font-weight 属性

📅  最后修改于: 2021-09-01 02:44:54             🧑  作者: Mango

CSS 的font-weight属性用于设置与 HTML 文本一起使用的字体的粗细。应用的字体粗细将取决于使用的字体系列浏览器。例如,某些字体系列仅适用于特定的权重。

句法:

font-weight: normal | bold | lighter | bolder | number | initial |
inherit | unset;

关键字值

  • normal:这定义了正常字体粗细(默认字体粗细)。它等于数字值400
  • 粗体:这定义了粗体字重,它等于数字值700

相对关键字值

  • 更轻:考虑到字体系列的可用字体粗细,这使得字体粗细比父元素轻一级。
  • 粗:考虑到字体系列的可用字体粗细,这使得字体粗细比父元素重一级。

数值

  • 数字:根据指定的数字设置字体粗细。该数字的范围在11000之间。如果无法获得准确的重量,则应用合适的重量。

全球价值观

  • 初始:这将字体粗细设置为初始(默认)值。
  • 继承:这将字体粗细设置为等于从其父元素继承的值。
  • unset:这将字体粗细设置为等于从其父元素继承的值,因为font-weight可继承的属性。

示例


  


     font-weight property 
  
    
    

  

    
    

        Prepare for the Recruitment drive of product          based companies like Microsoft, Amazon, Adobe          etc with a free online placement preparation          course. The course focuses on various MCQ's          & Coding question likely to be asked in the          interviews & make your upcoming placement          season efficient and successful.      

            

        Prepare for the Recruitment drive of product          based companies like Microsoft, Amazon, Adobe          etc with a free online placement preparation          course. The course focuses on various MCQ's          & Coding question likely to be asked in the          interviews & make your upcoming placement          season efficient and successful.     

            

        Prepare for the Recruitment drive of product          based companies like Microsoft, Amazon, Adobe          etc with a free online placement preparation          course. The course focuses on various MCQ's          & Coding question likely to be asked in the          interviews & make your upcoming placement          season efficient and successful.     

            

        Prepare for the Recruitment drive of product          based companies like Microsoft, Amazon, Adobe          etc with a free online placement preparation          course. The course focuses on various MCQ's          & Coding question likely to be asked in the          interviews & make your upcoming placement          season efficient and successful.     

                    

输出:
CSS 属性:font-weight

支持的浏览器: CSS支持的浏览器 | font-weight 属性如下:

  • 谷歌浏览器 2.0
  • 浏览器 4.0
  • 火狐 1.0
  • Safari 1.3
  • 歌剧 3.5

参考: Mozilla 开发者网络 (MDN)

如果您发现任何错误或有改进建议,请在下面发表评论。