aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/css/outline-style
diff options
context:
space:
mode:
authorPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
committerPeter Bengtsson <mail@peterbe.com>2020-12-08 14:40:17 -0500
commit33058f2b292b3a581333bdfb21b8f671898c5060 (patch)
tree51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/outline-style
parent8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff)
downloadtranslated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2
translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip
initial commit
Diffstat (limited to 'files/zh-cn/web/css/outline-style')
-rw-r--r--files/zh-cn/web/css/outline-style/index.html272
1 files changed, 272 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/outline-style/index.html b/files/zh-cn/web/css/outline-style/index.html
new file mode 100644
index 0000000000..b72b7ca9d3
--- /dev/null
+++ b/files/zh-cn/web/css/outline-style/index.html
@@ -0,0 +1,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>&lt;br-style&gt; </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">&lt;div&gt;
+ &lt;div class="dotted"&gt;
+ &lt;p class="dashed"&gt;Outline Demo&lt;/p&gt;
+ &lt;/div&gt;
+&lt;/div&gt; </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">&lt;div&gt;
+ &lt;div class="solid"&gt;
+ &lt;p class="double"&gt;Outline Demo&lt;/p&gt;
+ &lt;/div&gt;
+&lt;/div&gt; </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">&lt;div&gt;
+ &lt;div class="groove"&gt;
+ &lt;p class="ridge"&gt;Outline Demo&lt;/p&gt;
+ &lt;/div&gt;
+&lt;/div&gt;</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">&lt;div&gt;
+ &lt;div class="inset"&gt;
+ &lt;p class="outset"&gt;Outline Demo&lt;/p&gt;
+ &lt;/div&gt;
+&lt;/div&gt;</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>