CSS Reference Property

outline-width

The outline-width property is used to set the width of an element’s outline.

An outline is a line that is drawn outside the borders of an element to make it stand out on the page. It is usually used for accessibility reasons, and can be used for decoration purposes. Refer to the outline property entry for more information about outlines, how they differ from borders, and more.

The outline-width property is a longhand property that can be specified as part of the shorthand outline property. It is usually more convenient to set the outline of an element using the shorthand property.

Official Syntax

  • Syntax:

    outline-width: thin | medium | thick | <length> | inherit
  • Initial: medium
  • Applies To: all elements
  • Animatable: yes, as a length

Values

thin
A thin border.
medium
A medium border.
thick
A thick border.
<length>
See the <length> property entry for a list of possible length values.
inherit
The element inherits its outline width from its parent.

Notes

The interpretation of the first three values depends on the browser. The following relationships must hold, however:

thin <=medium <= thick.

Furthermore, these widths must be constant throughout a document.

Examples

The following adds a 2px-width purple outline to input fields when they are focused/tabbed. The color and style of the outline are set using the outline-color and outline-style properties.

input[type="text"]:focus {
    outline-width: 2px;
    outline-style: solid;
    outline-color: purple;
}

Live Demo

The following demo sets the outline width on boxes (<div>s) with a deepPink outline.

View this demo on the Codrops Playground

Browser Support

The outline-width property is supported in all major browsers: Chrome, Firefox, Safari, Opera, and on Android and iOS. In Internet Explorer, the property is supported starting from version 8.

Written by . Last updated February 3, 2015 at 12:34 pm by Pedro Botelho.

Do you have a suggestion, question or want to contribute? Submit an issue.