CSS outline-style

The CSS outline-style property is used to specify the style of an element's outline.

Unlike an element's border (e.g. set using border or its associated properties), an element's outline does not take up extra space and it can be non-rectangular.

The outline is always on top of a box, and it does not influence the position or size of the box, or of any other boxes. Therefore, displaying or suppressing outlines does not cause reflow or overflow.

User agents typically render an outline on elements in the :focus state.


The outline-style property accepts most of the same values that border-style accepts, with a couple of exceptions (noted below).

Details on these values below.

Possible Values

Specifies that the user agent can render a custom outline style. This could be an outline in the default style for the platform, or some other style that's not covered by CSS.
No outline. Color and width are ignored.
A series of round dots.
A series of square-ended dashes.
A single line segment.
Two parallel solid lines with some space between them. When using this value, the border-width value determines the sum of the lines and the space between them.
Looks as if it were carved in the canvas.
Looks as if it were coming out of the canvas.
Looks as if the content on the inside of the border is sunken into the canvas. Treated as ridge in the collapsing border model.
Looks as if the content on the inside of the border is coming out of the canvas. Treated as groove in the collapsing border model.

In addition, all CSS properties also accept the following CSS-wide keyword values as the sole component of their property value:

Represents the value specified as the property's initial value.
Represents the computed value of the property on the element's parent.
This value acts as either inherit or initial, depending on whether the property is inherited or not. In other words, it sets all properties to their parent value if they are inheritable or to their initial value if not inheritable.

General Information

Initial Value
Applies To
All elements

Example Code

Accessibility Considerations

The CSS spec warns against removing the outline on elements in the :focus state:

Keyboard users, in particular people with disabilities who may not be able to interact with the page in any other fashion, depend on the outline being visible on elements in the :focus state, thus authors must not make the outline invisible on such elements without making sure an alternative highlighting mechanism is provided.

Official Specifications