Latest web development tutorials

CSS font-weight 屬性

實例

三段文字設置不同的字體粗細:

p.normal {font-weight:normal;}
p.thick {font-weight:bold;}
p.thicker {font-weight:900;}

嘗試一下»

屬性定義及使用說明

font-weight 屬性設置文本的粗細

默認值: normal
繼承: yes
版本: CSS1
JavaScript 語法: object.style.fontWeight="900"


瀏覽器支持

表格中的數字表示支持該屬性的第一個瀏覽器版本號。

属性
font-weight 2.0 4.0 1.0 1.3 3.5

屬性值

描述
normal 默認值。 定義標準的字符。
bold 定義粗體字符。
bolder 定義更粗的字符。
lighter 定義更細的字符。
  • 100
  • 200
  • 300
  • 400
  • 500
  • 600
  • 700
  • 800
  • 900
定義由粗到細的字符。 400 等同於normal,而700 等同於bold。
inherit 規定應該從父元素繼承字體的粗細。


相關文章

CSS教程: CSS Font

CSS參考手冊: font屬性