--- title: text-decoration-line slug: Web/CSS/text-decoration-line tags: - CSS - CSS 属性 - CSS 文本修饰 - 参考 translation_of: Web/CSS/text-decoration-line ---
CSS 属性 text-decoration-line
用于设置元素中的文本的修饰类型。当要设置多个线修饰属性时,用 {{cssxref("text-decoration")}} 简写属性会比分别写多个属性更方便。
/* Keyword values */ text-decoration-line: none; text-decoration-line: underline; text-decoration-line: overline; text-decoration-line: line-through; text-decoration-line: blink; text-decoration-line: underline overline; /* Two decoration lines */ text-decoration-line: overline underline line-through; /* Multiple decoration lines */ /* Global values */ text-decoration-line: inherit; text-decoration-line: initial; text-decoration-line: unset;
{{cssinfo}}
text-decoration-line
属性可以设置为 none
, 或者一个及多个用空格分隔的下列值。
none
underline
overline
line-through
blink {{deprecated_inline}}
<p class="wavy">Here's some text with wavy red underline!</p> <p class="both">This text has lines both above and below it.</p>
.wavy { text-decoration-line: underline; text-decoration-style: wavy; text-decoration-color: red; } .both { text-decoration-line: underline overline; }
{{ EmbedLiveSample('Examples', '', '', '') }}
规范 | 状态 | 备注 |
---|---|---|
{{SpecName('CSS3 Text Decoration', '#text-decoration-line', 'text-decoration-line')}} | {{Spec2('CSS3 Text Decoration')}} |
初次定义。{{cssxref("text-decoration")}} 属性同时变成了定义多个相关属性的简写形式。 |
{{Compat("css.properties.text-decoration-line")}}