blob: b72b7ca9d3d46fb688e148e561ed49801a7f63af (
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
|
---
title: outline-style
slug: Web/CSS/outline-style
tags:
- outline-style
translation_of: Web/CSS/outline-style
---
<div>{{CSSRef}}</div>
<h2 id="概要">概要</h2>
<p><strong><code>outline-style</code></strong> CSS 属性被用于设置一个元素轮廓的样式。</p>
<p>元素轮廓是绘制于元素周围的一条线,位于{{cssxref("border")}}的外围,使元素突出</p>
<p>大多时候使用{{cssxref("outline")}}而不是<code> outline-style</code>,<code> outline-width <font face="Open Sans, arial, x-locale-body, sans-serif"><span style="background-color: #ffffff;">和</span></font></code><code> outline-color</code>会更方便.</p>
<p>{{cssinfo}}</p>
<h2 id="语法">语法</h2>
<pre class="brush:css">/* 关键字 值 */
outline-style: auto;
outline-style: none;
outline-style: dotted;
outline-style: dashed;
outline-style: solid;
outline-style: double;
outline-style: groove;
outline-style: ridge;
outline-style: inset;
outline-style: outset;
/* 全局 值*/
outline-style: inherit;
outline-style: initial;
outline-style: unset;
</pre>
<h2 id="取值">取值</h2>
<p><code><br-style> </code>可为以下这些值:</p>
<dl>
<dt>none</dt>
<br>
<dd>无轮廓 ({{Cssxref("outline-width")}} 为<code> 0</code>).</dd>
<dt>dotted</dt>
<br>
<dd style="outline: 10px dotted red;">轮廓为一系列点.</dd>
<dt>dashed</dt>
<br>
<dd style="outline: 10px dashed red;">轮廓为一系列短线.</dd>
<dt>solid</dt>
<br>
<dd style="outline: 10px solid red;">轮廓为实线.</dd>
<dt>double</dt>
<br>
<dd style="outline: 10px double red;">轮廓为两根有空隙的线. {{Cssxref("outline-width")}} 为线与空间的总和.</dd>
<dt>groove</dt>
<br>
<dd style="outline: 10px groove red;">轮廓呈凹下状.</dd>
<dt>ridge</dt>
<br>
<dd style="outline: 10px ridge red;">与<code> groove相反</code>: 轮廓呈凸起状.</dd>
<dt>inset</dt>
<br>
<dd style="outline: 10px inset red;">轮廓呈嵌入状.</dd>
<dt>outset</dt>
<br>
<dd style="outline: 10px outset red;">与<code> inset相反</code>: 轮廓呈突出状.</dd>
</dl>
<h3 id="正式语法">正式语法</h3>
<pre class="syntaxbox">{{csssyntax}}</pre>
<h2 id="Example_1_-_dotted_and_dashed" name="Example_1_-_dotted_and_dashed">示例 1 <code>dotted</code> 和 <code>dashed</code></h2>
<h3 id="HTML">HTML</h3>
<pre class="brush: html"><div>
<div class="dotted">
<p class="dashed">Outline Demo</p>
</div>
</div> </pre>
<h3 id="CSS">CSS</h3>
<pre class="brush: css">.dotted {
outline-style: dotted; /* 于 "outline: dotted"等价 */
}
.dashed {
outline-style: dashed;
}
/* 让效果更清楚 */
* { outline-width: 10px; padding: 15px; } </pre>
<p>{{ EmbedLiveSample('Example_1_-_dotted_and_dashed') }}</p>
<h2 id="Example_2_-_solid_and_double" name="Example_2_-_solid_and_double">示例 2 - <code>solid</code> 和 <code>double</code></h2>
<h3 id="HTML_2">HTML</h3>
<pre class="brush: html"><div>
<div class="solid">
<p class="double">Outline Demo</p>
</div>
</div> </pre>
<h3 id="CSS_2">CSS</h3>
<pre class="brush: css">.solid {
outline-style: solid;
}
.double {
outline-style: double;
}
/* 让效果更清楚 */
* { outline-width: 10px; padding: 15px; } </pre>
<p>{{ EmbedLiveSample('Example_2_-_solid_and_double') }}</p>
<h2 id="Example_3_-_groove_and_ridge" name="Example_3_-_groove_and_ridge">示例 3 - <code>groove</code> 和 <code>ridge</code></h2>
<h3 id="HTML_3">HTML</h3>
<pre class="brush: html"><div>
<div class="groove">
<p class="ridge">Outline Demo</p>
</div>
</div></pre>
<h3 id="CSS_3">CSS</h3>
<pre class="brush: css">.groove {
outline-style: groove;
}
.ridge {
outline-style: ridge;
}
/* 让效果更清楚 */
* { outline-width: 10px; padding: 15px; }</pre>
<p>{{ EmbedLiveSample('Example_3_-_groove_and_ridge') }}</p>
<h2 id="Example_4_-_inset_and_outset" name="Example_4_-_inset_and_outset">示例 4 - <code>inset</code> 和 <code>outset</code></h2>
<h3 id="HTML_4">HTML</h3>
<pre class="brush: html"><div>
<div class="inset">
<p class="outset">Outline Demo</p>
</div>
</div></pre>
<h3 id="CSS_4">CSS</h3>
<pre class="brush: css">.inset {
outline-style: inset;
}
.outset {
outline-style: outset;
}
/* 让效果更清楚 */
* { outline-width: 10px; padding: 15px; }</pre>
<p>{{ EmbedLiveSample('Example_4_-_inset_and_outset') }}</p>
<h2 id="规范">规范</h2>
<table class="standard-table">
<thead>
<tr>
<th scope="col">Specification</th>
<th scope="col">Status</th>
<th scope="col">Comment</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{SpecName('CSS3 Basic UI', '#outline-style', 'outline-style')}}</td>
<td>{{Spec2('CSS3 Basic UI')}}</td>
<td>Added <code>auto</code> value</td>
</tr>
<tr>
<td>{{SpecName('CSS2.1', 'ui.html#propdef-outline-style', 'outline-style')}}</td>
<td>{{Spec2('CSS2.1')}}</td>
<td>Initial definition</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性">浏览器兼容性</h2>
<p>{{Compat("css.properties.outline-style")}}</p>
<div>{{CompatibilityTable}}</div>
<div id="compat-desktop">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Chrome</th>
<th>Edge</th>
<th>Firefox (Gecko)</th>
<th>Internet Explorer</th>
<th>Opera</th>
<th>Safari (WebKit)</th>
</tr>
<tr>
<td>Basic support</td>
<td>1.0</td>
<td>{{CompatVersionUnknown}}</td>
<td>1.5 (1.8)<sup>[1]</sup></td>
<td>8.0</td>
<td>7.0</td>
<td>1.2 (125)</td>
</tr>
<tr>
<td><code>auto</code></td>
<td>{{CompatUnknown}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<div id="compat-mobile">
<table class="compat-table">
<tbody>
<tr>
<th>Feature</th>
<th>Android</th>
<th>Edge</th>
<th>Firefox Mobile (Gecko)</th>
<th>IE Phone</th>
<th>Opera Mobile</th>
<th>Safari Mobile</th>
</tr>
<tr>
<td>Basic support</td>
<td>2.1</td>
<td>{{CompatVersionUnknown}}</td>
<td>{{CompatGeckoMobile("46")}}</td>
<td>10</td>
<td>12</td>
<td>3.2</td>
</tr>
<tr>
<td><code>auto</code></td>
<td>{{CompatUnknown}}</td>
<td>{{CompatNo}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
<td>{{CompatUnknown}}</td>
</tr>
</tbody>
</table>
</div>
<p>[1] <a href="/zh-CN/docs/Gecko">Gecko</a> 1.8及以前 (<a href="/zh-CN/docs/Firefox_1.5_for_developers">Firefox 1.5</a>) 该效果可用<a href="/zh-CN/docs/CSS/CSS_Reference/Mozilla_Extensions">Mozilla CSS Extension</a> 实现{{Cssxref("-moz-outline-style")}}.</p>
|