text-decoration-style
CSS
property sets the style of the lines specified by
text-decoration-line
. The style applies to all lines that are set with
text-decoration-line
.
The source for this interactive example is stored in a GitHub repository. If you'd like to contribute to the interactive examples project, please clone https://github.com/mdn/interactive-examples and send us a pull request.
If the specified decoration has a specific semantic meaning, like a line-through line meaning that some text has been deleted, authors are encouraged to denote this meaning using an HTML tag, like
<del>
or
<s>
. As browsers can disable styling in some cases, the semantic meaning won't disappear in such a situation.
When setting multiple line-decoration properties at once, it may be more convenient to use the
text-decoration
shorthand property instead.
/* Keyword values */ text-decoration-style: solid; text-decoration-style: double; text-decoration-style: dotted; text-decoration-style: dashed; text-decoration-style: wavy; /* Global values */ text-decoration-style: inherit; text-decoration-style: initial; text-decoration-style: unset;
Draws a single line.
Draws a double line.
Draws a dotted line.
Draws a dashed line.
Draws a wavy line.
text-decoration-line
: none
代替。
| 初始值 |
solid
|
|---|---|
| 适用于 |
所有元素。它还适用于
::first-letter
and
::first-line
.
|
| 继承 | no |
| 计算值 | 如指定 |
| 动画类型 | discrete |
solid | double | dotted | dashed | wavy
.wavy {
text-decoration-line: underline;
text-decoration-style: wavy;
text-decoration-color: red;
}
<p class="wavy">This text has a wavy red line beneath it.</p>
| 规范 | 状态 | 注释 |
|---|---|---|
|
CSS Text Decoration Module Level 3
The definition of 'text-decoration-style' in that specification. |
候选推荐 |
Initial definition. The
text-decoration
property is now a shorthand to define multiple related properties.
|
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
text-decoration-style
|
Chrome 完整支持 57 | Edge 完整支持 79 |
Firefox
完整支持
36
|
IE 不支持 No | Opera 完整支持 44 | Safari 完整支持 12.1 | WebView Android 完整支持 57 | Chrome Android 完整支持 57 |
Firefox Android
完整支持
36
|
Opera Android 完整支持 43 | Safari iOS 完整支持 12.2 | Samsung Internet Android 完整支持 7.0 |
wavy
|
Chrome 完整支持 57 | Edge 完整支持 79 | Firefox 完整支持 6 | IE 不支持 No | Opera 完整支持 44 | Safari 完整支持 8 | WebView Android 完整支持 57 | Chrome Android 完整支持 57 | Firefox Android 完整支持 6 | Opera Android 完整支持 43 | Safari iOS 完整支持 8 | Samsung Internet Android 完整支持 7.0 |
完整支持
不支持
要求使用供应商前缀或不同名称。
text-decoration
shorthand property instead.