这篇翻译不完整。请帮忙从英语翻译这篇文章

outline-color CSS属性 被用于设置一个元素轮廓的颜色.

大多时候使用outline而不是 outline-style, outline-width  outline-color会更方便.

元素轮廓是绘制于元素周围的一条线,位于border的外围,使元素突出.不像border,轮廓在元素的frame外绘制并且可能与其他元素重叠.而border不会出现这种现象(除非故意).

语法

/* <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;

outline-color可用以下这些值.

Values

<color>
轮廓颜色,规则同 <color>.
invert
反色,用于确认轮廓的显示.注意不是所有浏览器都支持该属性,若不则该属性无效.

正规语法

<color> | invert

where
<color> = <rgb()> | <rgba()> | <hsl()> | <hsla()> | <hex-color> | <named-color> | currentcolor | <deprecated-system-color>

where
<rgb()> = rgb( <percentage>{3} [ / <alpha-value> ]? ) | rgb( <number>{3} [ / <alpha-value> ]? ) | rgb( <percentage>#{3} , <alpha-value>? ) | rgb( <number>#{3} , <alpha-value>? )
<rgba()> = rgba( <percentage>{3} [ / <alpha-value> ]? ) | rgba( <number>{3} [ / <alpha-value> ]? ) | rgba( <percentage>#{3} , <alpha-value>? ) | rgba( <number>#{3} , <alpha-value>? )
<hsl()> = hsl( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsl( <hue>, <percentage>, <percentage>, <alpha-value>? )
<hsla()> = hsla( <hue> <percentage> <percentage> [ / <alpha-value> ]? ) | hsla( <hue>, <percentage>, <percentage>, <alpha-value>? )

where
<alpha-value> = <number> | <percentage>
<hue> = <number> | <angle>

例子

HTML

<p>My outline is blue, as you can see.</p>

CSS

p {
  outline: 2px solid;      /* Set the outline width and style */
  outline-color: #0000FF;  /* Make the outline blue */
  margin: 5px;
}

Accessibility concerns

Custom focus styles commonly involve making adjustments to the 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.

Color contrast ratio is determined by comparing the luminosity of the text and background color values. In order to meet current Web Content Accessibility Guidelines (WCAG), 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 bold or larger, or 24px or larger.

规范

Specification Status Comment
CSS Basic User Interface Module Level 3
outline-color
Recommendation No change.
CSS Transitions
outline-color
Working Draft Defines outline-color as animatable.
CSS Level 2 (Revision 1)
outline-color
Recommendation Initial definition.

初始值invert, for browsers supporting it, currentColor for the other
适用元素all elements
是否是继承属性
适用媒体as each of the properties of the shorthand:
计算值For the keyword invert, the computed value is invert. For the color value, if the value is translucent, the computed value will be the rgba() corresponding one. If it isn't, it will be the rgb() corresponding one. The transparent keyword maps to rgba(0,0,0,0).
Animation typea color
正规顺序the unique non-ambiguous order defined by the formal grammar

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidEdge MobileFirefox for AndroidOpera for AndroidiOS SafariSamsung Internet
Basic supportChrome Full support 1Edge Full support 12Firefox Full support 1.5
Full support 1.5
No support 1 — 3.6
Prefixed
Prefixed Requires the vendor prefix: -moz-
IE Full support 8Opera Full support 7Safari Full support 1.2WebView Android ? Chrome Android ? Edge Mobile Full support YesFirefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android ?
invertChrome No support NoEdge ? Firefox No support ? — 3IE Full support 8Opera No support 7 — 15Safari No support NoWebView Android ? Chrome Android ? Edge Mobile ? Firefox Android ? Opera Android ? Safari iOS ? Samsung Internet Android No support No

Legend

Full support  
Full support
No support  
No support
Compatibility unknown  
Compatibility unknown
Requires a vendor prefix or different name for use.
Requires a vendor prefix or different name for use.

相关链接

文档标签和贡献者

此页面的贡献者: hhxxhg
最后编辑者: hhxxhg,