font-weight

font-weight attribute refers to the boldness or lightness of the glyphs used to render the text, relative to other fonts in the same font family.

注意: As a presentation attribute, font-weight can be used as a CSS property. See the css font-weight property for more information.

You can use this attribute with the following SVG elements:

范例

<svg viewBox="0 0 200 30" xmlns="http://www.w3.org/2000/svg">
  <text y="20" font-weight="normal">Normal text</text>
  <text x="100" y="20" font-weight="bold">Bold text</text>
</svg>

					

用法注意事项

normal | bold | bolder | lighter | <number>
默认值 normal
Animatable Yes

For a description of the values, please refer to the CSS font-weight 特性。

规范

规范 状态 注释
CSS Fonts Module Level 4
The definition of 'font-weight' in that specification.
工作草案 定义 font-weight to accept any numbers between 1 and 1000.
CSS Fonts Module Level 3
The definition of 'font-weight' in that specification.
推荐 无变化
Scalable Vector Graphics (SVG) 1.1 (Second Edition)
The definition of 'font-weight' in that specification.
推荐 初始定义

浏览器兼容性

BCD tables only load in the browser

另请参阅

Found a problem with this page?

最后修改: , 由 MDN 贡献者