为 <h1>、<h2>、<h3> 和 <h4> 元素设置不同粗细的装饰线:
h1 {
text-decoration: underline;
text-decoration-thickness: auto;
}
h2 {
text-decoration: underline;
text-decoration-thickness: 5px;
}
h3 {
text-decoration: underline;
text-decoration-thickness: 50%;
}
/* Use shorthand property */
h4 {
text-decoration: underline solid red 50%;
}
亲自试一试 »
这个text-decoration-thickness
属性指定装饰线的粗细。
默认值: | 汽车 |
---|---|
遗传: | 不 |
可动画: | 不,查看各个属性。阅读可动画的 |
版本: | CSS4 |
JavaScript 语法: | 对象.style.textDecorationThickness="5px"尝试一下 |
表中的数字指定完全支持该属性的第一个浏览器版本。
Property | |||||
---|---|---|---|---|---|
text-decoration-thickness | 89.0 | 89.0 | 70.0 | 12.1 | 75.0 |
text-decoration-thickness: auto|from-font|
length/
percentage|initial|inherit;
Value | Description |
---|---|
auto | The browser chooses the thickness of the decoration line |
from-font | If a font file contains information about a preferred thickness, use that value. If not, behave as auto |
length/percentage | Specifies the thickness as a length or % |
initial | Sets this property to its default value. Read about initial |
inherit | Inherits this property from its parent element. Read about inherit |
CSS 参考:文本装饰属性
CSS教程:CSS 文本装饰
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!