GO-V.ORG
As seen in

`outline-color` CSS property

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

The **`outline-color`** [CSS](/docs/Web/CSS) property sets the color of an element's outline.

CSS Demo: outline-color

```css interactive-example-choice
outline-color: red;
```

```css interactive-example-choice
outline-color: #32a1ce;
```

```css interactive-example-choice
outline-color: rgb(170 50 220 / 0.6);
```

```css interactive-example-choice
outline-color: hsl(60 90% 50% / 0.8);
```

```css interactive-example-choice
outline-color: currentColor;
```

```html interactive-example
<section class="default-example" id="default-example">
<div class="transition-all" id="example-element">
This is a box with an outline around it.
</div>
</section>
```

```css interactive-example
#example-element {
outline: 0.75em solid;
padding: 0.75em;
width: 80%;
height: 100px;
}
```

## Syntax

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

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

- &lt;color&gt;
- : The color of the outline, specified as a `<color>`.

The specification also lists an additional value, `auto`, which is not currently supported in any browsers. When implemented, `auto` will compute to [`currentColor`](/docs/Web/CSS/Reference/Values/color_value#currentcolor_keyword) unless outline-style is set to `auto` then it will compute to the [accent color](/docs/Web/CSS/Reference/Properties/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

Custom [focus styles](/docs/Web/CSS/Reference/Selectors/:focus) 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.

An outline is a visual indicator. In order to meet current [Web Content Accessibility Guidelines (WCAG)](https://www.w3.org/WAI/standards-guidelines/wcag/), [Success Criterion 1.4.11 Non-text Contrast](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast) requires a contrast ratio of at least 3:1 between the outline and the adjacent colors it sits against. Note that when the outline is used as a focus indicator, the adjacent colors include both the background outside the element and the element's own background when the outline borders both.

- [WebAIM: Color Contrast Checker](https://webaim.org/resources/contrastchecker/)
- [MDN Understanding WCAG, Guideline 1.4 explanations](/docs/Web/Accessibility/Guides/Understanding_WCAG/Perceivable#guideline_1.4_make_it_easier_for_users_to_see_and_hear_content_including_separating_foreground_from_background)
- [Understanding Success Criterion 1.4.11: Non-text Contrast | W3C Understanding WCAG 2.2](https://www.w3.org/WAI/WCAG22/Understanding/non-text-contrast)

## Formal definition

## Formal syntax

## 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: blue; /* Set the outline color */
margin: 5px;
}
```

#### Result

Setting_a_solid_blue_outline

## Specifications

## Browser compatibility

## See also

- outline
- outline-width
- outline-style
- The &lt;color&gt; 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

source: MDN Web Docs mirror · page

Cite this

"`outline-color` CSS property". MDN Web Docs. CC BY-SA 2.5 (MDN). https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/outline-color

JSON record · API collection · BibTeX · RIS · CSL-JSON · citation policy

Save to pass ·