CSS outline-color Property
Description
The outline-color
CSS property is used to specify the color of the outline that is applied to an element when it gains focus, typically through keyboard navigation or when clicked. Outlines are essential for ensuring accessibility, as they provide a visible indication of which element is currently focused, aiding users who rely on keyboard navigation or screen readers. By setting the outline-color
, web developers can customize the color of this focus indicator to match their design while maintaining accessibility standards.
- Initial value
- invert
- Applies to
- All elements
- Inherited
- No
- Computed value
- The computed value for 'invert is invert'. For [color] values, the computed value is as defined for the 'color' property
- Animatable
- No
- JavaScript syntax
- object.style.outlineColor
Interactive Demo
Syntax
outline-color: <color> | invert | inherit
Values
- <color>Specify the color to use on all outlines. This can be anywhere from one to four values representing the top, right, bottom, and left outline respectively.
- invertThis is expected to perform a color inversion on the pixels on the screen.
- inherit
Example
<div class="block">Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</div>
.block {
outline-style: dotted;
outline-width: 3px;
outline-color: blue;
padding: 10px;
}
Browser Support
The following table will show you the current browser support for the CSS outline-color
property.
Desktop | |||||
12 | 1 | 1.5 | 7 | 1.2 |
Tablets / Mobile | |||||
18 | 4 | 14 | 1 | 1 | 37 |
Last updated by CSSPortal on: 2nd January 2024