blob: 33d3cce79b2162e671270bee04cb18a06760d0b8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
---
title: text-decoration-style
slug: Web/CSS/text-decoration-style
tags:
- CSS
- CSS Property
- CSS Text Decoration
- Layout
- Reference
translation_of: Web/CSS/text-decoration-style
---
<div>{{CSSRef}}</div>
<p><a href="/en-US/docs/CSS">CSS</a> 属性 <strong><code>text-decoration-style</code></strong> 用于设置由 {{ cssxref("text-decoration-line") }} 设定的线的样式。线的样式会应用到所有被 <code>text-decoration-line</code> 设定的线,不能为其中的每条线设置不同的样式。当要设置多个线修饰属性时,用 {{cssxref("text-decoration")}} 简写属性会比分别写多个属性更方便。</p>
<div>{{EmbedInteractiveExample("pages/css/text-decoration-style.html")}}</div>
<p>如果设定的修饰效果具有特定的语义,例如删除线的意味着某些文本被删除了,开发者最好使用有语义的 HTML 标签来表达,比如 {{ HTMLElement("del") }} 或 {{ HTMLElement("s") }} 标签,因为浏览器有时可能会屏蔽某些样式,但语义化的标签则不会出现这样的问题。</p>
<p>当一次使用多个 line-decoration 属性时,使用 {{cssxref("text-decoration")}} 简写属性会更方便。</p>
<h2 id="语法">语法</h2>
<pre class="brush: css no-line-numbers">/* 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;
</pre>
<h3 id="值">值</h3>
<dl>
<dt>solid</dt>
<dd>画一条实线。</dd>
<dt>double</dt>
<dd>画一条双实线。</dd>
<dt>dotted</dt>
<dd>画一条点划线。</dd>
<dt>dashed</dt>
<dd>画一条虚线。</dd>
<dt>wavy</dt>
<dd>画一条波浪线。</dd>
<dt>-moz-none{{ non-standard_inline }}</dt>
<dd>不画线。亦可用 {{ cssxref("text-decoration-line") }}<code>: none</code> 替代。</dd>
</dl>
<h3 id="格式化语法">格式化语法</h3>
<pre class="syntaxbox">{{csssyntax}}</pre>
<h2 id="示例">示例</h2>
<div id="Examples">
<pre class="brush: css" style="display: none;">.example {
-moz-text-decoration-line: underline;
-moz-text-decoration-style: wavy;
-moz-text-decoration-color: red;
-webkit-text-decoration-line: underline;
-webkit-text-decoration-style: wavy;
-webkit-text-decoration-color: red;
}</pre>
<pre class="brush: css">.wavy {
text-decoration-line: underline;
text-decoration-style: wavy;
text-decoration-color: red;
}
</pre>
<pre class="brush: html"><p class="wavy">This text has a wavy red line beneath it.</p>
</pre>
<p>{{ EmbedLiveSample('Examples', '', '', '') }}</p>
</div>
<h2 id="规范">规范</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">规范</th>
<th scope="col">状态</th>
<th scope="col">备注</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ SpecName('CSS3 Text Decoration', '#text-decoration-style', 'text-decoration-style') }}</td>
<td>{{ Spec2('CSS3 Text Decoration') }}</td>
<td>初次定义。{{cssxref("text-decoration")}} 属性同时变成了定义多个相关属性的简写形式。</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p> </p>
<p>{{Compat("css.properties.text-decoration-style")}}</p>
<p> </p>
<h2 id="另请参阅">另请参阅</h2>
<ul>
<li>当要设置多个线修饰属性时,用 {{cssxref("text-decoration")}} 简写属性会比分别写多个属性更方便</li>
</ul>
<p> </p>
|