font-weight
>font-weight 属性表示用于渲染文本的字形相对于同一字体家族中其他字体的粗细程度。
备注:作为表现属性,font-weight 也有一个对应的 CSS 属性:font-weight。当两者都被指定时,CSS 属性优先。
你可以将此属性与以下 SVG 元素一起使用:
示例
>控制 SVG 粗细
html
<svg viewBox="0 0 200 30" xmlns="http://www.w3.org/2000/svg">
<text y="20" font-weight="normal">正常文本</text>
<text x="100" y="20" font-weight="bold">粗体文本</text>
</svg>
使用说明
| 值 |
normal | bold | bolder |
lighter | <number>
|
|---|---|
| 默认值 | normal |
| 动画性 | 是 |
有关各值的说明,请参阅 CSS font-weight 属性。
规范
| 规范 |
|---|
| CSS Fonts Module Level 4> # font-weight-prop> |
浏览器兼容性
参见
- CSS
font-weight属性