diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/css/outline-color | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/css/outline-color')
-rw-r--r-- | files/zh-cn/web/css/outline-color/index.html | 122 |
1 files changed, 122 insertions, 0 deletions
diff --git a/files/zh-cn/web/css/outline-color/index.html b/files/zh-cn/web/css/outline-color/index.html new file mode 100644 index 0000000000..457caab022 --- /dev/null +++ b/files/zh-cn/web/css/outline-color/index.html @@ -0,0 +1,122 @@ +--- +title: outline-color +slug: Web/CSS/outline-color +translation_of: Web/CSS/outline-color +--- +<div><span style="line-height: 1.5;">{{CSSRef}}</span></div> + +<p><strong><code>outline-color</code></strong> CSS属性 被用于设置一个元素轮廓的颜色.</p> + +<div>{{EmbedInteractiveExample("pages/css/outline-color.html")}}</div> + +<p class="hidden">这个展示项目的源码由GitHub托管 . 如果你对这个展示项目感兴趣,可以clone <a href="https://github.com/mdn/interactive-examples">https://github.com/mdn/interactive-examples</a> 并向我们提交一个pull request.</p> + +<p>大多时候使用{{cssxref("outline")}}而不是<code> outline-style</code>,<code> outline-width <font face="Open Sans, arial, x-locale-body, sans-serif">和</font></code><code> outline-color</code>会更方便.</p> + +<p>元素轮廓是绘制于元素周围的一条线,位于{{cssxref("border")}}的外围,使元素突出.不像border,轮廓在元素的frame外绘制并且可能与其他元素重叠.而border不会出现这种现象(除非故意).</p> + +<h2 id="语法">语法</h2> + +<pre class="brush:css no-line-numbers">/* <color> values */ +outline-color: #f92525; +outline-color: rgb(30,222,121); +outline-color: blue; + +/* Keyword value */ +outline-color: invert; + +/* Global values */ +outline-color: inherit; +outline-color: initial; +outline-color: unset; +</pre> + +<p><code>outline-color</code>可用以下这些值.</p> + +<h3 id="Values">Values</h3> + +<dl> + <dt>{{cssxref("<color>")}}</dt> + <dd>轮廓颜色,规则同 <code><color></code>.</dd> + <dt><code>invert</code></dt> + <dd><code>反色,用于确认轮廓的显示.注意不是所有浏览器都支持该属性,若不则该属性无效.</code></dd> +</dl> + +<h3 id="正规语法">正规语法</h3> + +<pre class="syntaxbox">{{csssyntax}}</pre> + +<h2 id="例子">例子</h2> + +<h3 id="HTML">HTML</h3> + +<pre class="brush: html;"><p>My outline is blue, as you can see.</p></pre> + +<h3 id="CSS">CSS</h3> + +<pre class="brush: css; highlight:[3]">p { + outline: 2px solid; /* Set the outline width and style */ + outline-color: #0000FF; /* Make the outline blue */ + margin: 5px; +}</pre> + +<p>{{ EmbedLiveSample('Example') }}</p> + +<h2 id="Accessibility_concerns">Accessibility concerns</h2> + +<p>Custom <a href="/zh-CN/docs/Web/CSS/:focus">focus styles</a> commonly involve making adjustments to the {{cssxref("outline")}} property. If the color of the outline is adjusted, it is important to ensure that the contrast ratio between it and the background the outline is placed over is high enough that people experiencing low vision conditions will be able to perceive it.</p> + +<p>Color contrast ratio is determined by comparing the luminosity of the text and background color values. In order to meet current <a href="https://www.w3.org/WAI/intro/wcag">Web Content Accessibility Guidelines (WCAG)</a>, a ratio of 4.5:1 is required for text content and 3:1 for larger text such as headings. Large text is defined as 18.66px and <a href="/en-US/docs/Web/CSS/font-weight">bold</a> or larger, or 24px or larger.</p> + +<ul> + <li><a href="https://webaim.org/resources/contrastchecker/">WebAIM: Color Contrast Checker</a></li> + <li><a href="https://developer.mozilla.org/en-US/docs/Web/Accessibility/Understanding_WCAG/Perceivable#Guideline_1.4_Make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background">MDN Understanding WCAG, Guideline 1.4 explanations</a></li> + <li><a href="https://www.w3.org/TR/UNDERSTANDING-WCAG20/visual-audio-contrast-contrast.html">Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0</a></li> +</ul> + +<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-color', 'outline-color')}}</td> + <td>{{Spec2('CSS3 Basic UI')}}</td> + <td>No change.</td> + </tr> + <tr> + <td>{{SpecName('CSS3 Transitions', '#animatable-css', 'outline-color')}}</td> + <td>{{Spec2('CSS3 Transitions')}}</td> + <td>Defines <code>outline-color</code> as animatable.</td> + </tr> + <tr> + <td>{{SpecName('CSS2.1', 'ui.html#propdef-outline-color', 'outline-color')}}</td> + <td>{{Spec2('CSS2.1')}}</td> + <td>Initial definition.</td> + </tr> + </tbody> +</table> + +<p>{{cssinfo}}</p> + +<h2 id="Browser_compatibility" name="Browser_compatibility">浏览器兼容性</h2> + +<div> + + +<p>{{Compat("css.properties.outline-color")}}</p> +</div> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li>{{cssxref("<color>")}} 数据类型</li> + <li>其他与颜色有关的属性: {{cssxref("color")}}, {{cssxref("background-color")}}, {{cssxref("border-color")}}, {{cssxref("text-decoration-color")}}, {{cssxref("text-emphasis-color")}}, {{cssxref("text-shadow")}}, {{cssxref("caret-color")}}, 和{{cssxref("column-rule-color")}}</li> + <li><a href="/zh-CN/docs/Web/HTML/Applying_color">Applying color to HTML elements using CSS</a></li> +</ul> |