首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

font-weight

font-weight属性是指用于呈现文本的字形相对于相同字体系列中的其他字体的粗细度。

作为一个表现属性,它也可以作为一个属性直接在一个CSS样式表中使用,请参阅css font-weight查看进一步的信息。

用法上下文

Categories

Presentation attribute

Value

normal | bold | bolder | lighter | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | inherit

Animatable

Yes

Normative document

SVG 1.1 (2nd Edition)

关键字的含义

  • bold 等于700
  • normal 等于 400
  • bolderligher将指示浏览器使用比当前元素的父母更粗或更细的字体粗细(分别)。子元素将继承计算的字体粗细。

注意事项

许多字体只有400和700的权重值可用。可用的权重值可能会在字体与字体之间不同。

实例

css

代码语言:javascript
复制
p.normal {font-weight:normal;}
p.thick {font-weight:bold;}
p.thicker {font-weight:900;}

html

代码语言:javascript
复制
<p class="normal">This is a paragraph.</p>
<p class="light">This is a paragraph.</p>
<p class="thick">This is a paragraph.</p>
<p class="thicker">This is a paragraph.</p>

适用元素

以下元素可以使用该font-weight属性

  • Text content elements »See also

扫码关注腾讯云开发者

领取腾讯云代金券