CSS outline-color property
Example
Set the color of a dashed outline:
p
{
outline-style:dotted;
outline-color:#00ff00;
}
Try it »
Property definition and usage
An outline is a line drawn around an element, outside the border edge.
The outline-color property specifies the color of the outline.
Note: Always declare the outline-style property before the outline-color property. An element can only change its outline color after it has an outline.
| Default value: | invert |
|---|---|
| Inherited: | no |
| Version: | CSS2 |
| JavaScript syntax: | object.style.outlineColor="#00FF00" |
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| outline-color | 1.0 | 8.0 | 1.5 | 1.2 | 7.0 |
Tips and Notes
An outline is around the element. It is a margin around the element. However, it comes from a different border property.
An outline is not part of the element's dimensions, so the element's width and height properties do not include the width of the outline.
Attribute values
| Value | Description |
|---|---|
| color | Specifies the outline color. See CSS color valuesthe complete list of color values. |
| invert | Default. Performs color inversion (the inverse color), which makes the outline visible against different background colors. |
| inherit | Specifies that the outline color should be inherited from the parent element. |
Related Articles
CSS Tutorial: CSS Outline
CSS Reference Manual: outline property