outline-color
=============

The **`outline-color`** CSS property sets the color of an element's outline.

Try it
------

Syntax
------


```css
/\* <color> values \*/
outline-color: #f92525;
outline-color: rgb(30 222 121);
outline-color: blue;

/\* Keyword value \*/
outline-color: auto;

/\* Global values \*/
outline-color: inherit;
outline-color: initial;
outline-color: revert;
outline-color: revert-layer;
outline-color: unset;
```


The `outline-color` property is specified as any one of the values listed below.

### Values

`<color>`

The color of the outline, specified as a `<color>`.

`auto` 
Experimental

Computes to `currentcolor` unless `outline-style` is set to `auto` then it computes to the accent color.

Description
-----------

An outline is a line that is drawn around an element, outside the `border`. Unlike the element's border, the outline is drawn outside the element's frame, and may overlap other content. The border, on the other hand, will actually alter the page's layout to ensure that it fits without overlapping anything else (unless you explicitly set it to overlap).

It is often more convenient to use the shorthand property `outline` when defining the appearance of an outline.

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.

* WebAIM: Color Contrast Checker
* MDN Understanding WCAG, Guideline 1.4 explanations
* Understanding Success Criterion 1.4.3 | W3C Understanding WCAG 2.0
Formal definition
-----------------

|  |  |
| --- | --- |
| Initial value | `auto` |
| Applies to | all elements |
| Inherited | no |
| Computed value | For the keyword `auto`, the computed value is `currentcolor`. 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 type | a color |

Formal syntax
-------------
```

outline-color =   
  auto                      |  
  [ <color> | <image-1D> ]    
  
<image-1D> =   
  <stripes()>    
  
<stripes()> =   
  stripes( <color-stripe># )    
  
<color-stripe> =   
  <color>                            &&  
  [ <length-percentage> | <flex> ]?    
  
<length-percentage> =   
  <length>      |  
  <percentage>    
  
```

Examples
--------

### Setting a solid blue outline

#### HTML


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


#### CSS


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


#### Result

Specifications
--------------

| Specification |
| --- |
| CSS Basic User Interface Module Level 4 # outline-color |

Browser compatibility
---------------------

BCD tables only load in the browser with JavaScript enabled. Enable JavaScript to view data.

See also
--------

* `outline`
* `outline-color`
* `outline-style`
* `outline-width`
* The `<color>` data type
* Other color-related properties: `color`, `background-color`, `border-color`, `text-decoration-color`, `text-emphasis-color`, `text-shadow`, `caret-color`, and `column-rule-color`
* Applying color to HTML elements using CSS