English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

CSS Reference Manual

CSS @rules (RULES)

Comprehensive list of CSS attributes

CSS outline-Usage and examples of the color attribute

outline-color CSS属性设置元素轮廓的颜色。然而,在许多情况下,我们更常用outlinecolor CSS attribute sets the color of the element's outline. However, in many cases, we use it more commonly

This shorthand property.

The following table provides usage instructions and version history of this attribute, as well as its usage syntax in JavaScript scripts.invert
Default value:Applies to:
All elementsInheritance:
NoAnimatable:Yes. Please refer to.
Animation propertiesCSS 2Version:3
JavaScript syntax:object

outline-.style.outlineColor="#000000"

color usage syntax

outline-The syntax of this attribute is as follows:

color: color | invert | initial | inherit-The following examples demonstrate how to use outline

  Example
   outline-p {
   outline-style: solid;
  color: #ff0000;
}/Test to see‹

Note:-attribute is declared before outlineoutline-styleThe element must have an outline before setting the outline color, because the color-The default value of styleproperty is none.

Attribute values

The following table describes the values of this attribute.

ValueDescription
colorSpecify the outline color.CSS color valuesto get the list of possible color values.
invertPerform color inversion on the screen pixels to ensure that the outline is visible regardless of the background color. This is the default value.
initialSet this property to its default value.
inheritIf specified, the associated element uses its parent element's outline-color attribute values.

Browser compatibility

outline-The compatibility of color attribute browsers, the numbers in the following table represent the minimum version number of browsers that support this attribute; all mainstream browsers support this attribute.

  • Firefox 1.5Above

  • Google Chrome1+

  • Internet Explorer 8+

  • Apple Safari 1.2+

  • Opera 7+

Warning: Internet Explorer 7and earlier versions do not support this outline-color attribute. IE8Supports this attribute, but requires an effective<!DOCTYPE>.

Read more

Please refer to the tutorials related to the following content:CSS outline,CSS border.

Related properties:outline,outline-width,outline-style.