aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/text-decoration-line/index.html
blob: 7615ef91a098816ba00dc8d787053d10682285ec (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
---
title: text-decoration-line
slug: Web/CSS/text-decoration-line
tags:
  - CSS
  - CSS 属性
  - CSS 文本修饰
  - 参考
translation_of: Web/CSS/text-decoration-line
---
<div>{{CSSRef}}</div>

<p><a href="/en-US/docs/CSS">CSS</a> 属性 <strong><code>text-decoration-line</code></strong> 用于设置元素中的文本的修饰类型。当要设置多个线修饰属性时,用 {{cssxref("text-decoration")}} 简写属性会比分别写多个属性更方便。</p>

<pre class="brush:css no-line-numbers">/* 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;
</pre>

<p>{{cssinfo}}</p>

<h2 id="语法">语法</h2>

<h3 id="值"></h3>

<p><code>text-decoration-line</code> 属性可以设置为 <code>none</code>, 或者<strong>一个及多个</strong>用空格分隔的下列值。</p>

<dl>
 <dt><code>none</code></dt>
 <dd>表示没有文本修饰效果。</dd>
 <dt><code>underline</code></dt>
 <dd>在文本的下方有一条修饰线。</dd>
 <dt><code>overline</code></dt>
 <dd>在文本的上方有一条修饰线。</dd>
 <dt><code>line-through</code></dt>
 <dd>有一条贯穿文本中间的修饰线。</dd>
 <dt><code>blink {{deprecated_inline}}</code></dt>
 <dd>文本闪烁(文本交替处于显示与隐藏状态)。客户代理都一致没有实现文本闪烁效果。考虑到为了支持使用 <a href="/en-US/docs/Web/CSS/animation">CSS 动画</a>,该值也<strong>不宜使用</strong></dd>
</dl>

<h3 id="格式化语法">格式化语法</h3>

{{csssyntax}}

<h2 id="示例">示例</h2>

<div id="Examples">
<pre class="brush: html">&lt;p class="wavy"&gt;Here's some text with wavy red underline!&lt;/p&gt;
&lt;p class="both"&gt;This text has lines both above and below it.&lt;/p&gt;</pre>

<pre class="brush: css">.wavy {
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: red;
}

.both {
  text-decoration-line: underline overline;
}</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-line', 'text-decoration-line')}}</td>
   <td>{{Spec2('CSS3 Text Decoration')}}</td>
   <td>
    <p>初次定义。{{cssxref("text-decoration")}} 属性同时变成了定义多个相关属性的简写形式。</p>
   </td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

<p> </p>



<p>{{Compat("css.properties.text-decoration-line")}}</p>

<p> </p>

<h2 id="另请参阅">另请参阅</h2>

<ul>
 <li>当要设置多个线修饰属性时,用 {{cssxref("text-decoration")}} 简写属性会比分别写多个属性更方便。</li>
</ul>