HTML Dog
Skip to navigation

CSS Property: outline

The width, style, and color of the outline around a box.

A shorthand property that combines outline-width, outline-style, and outline-color.

Possible Values

A space-separated list, containing up to three values representing outline-width, outline-style, and outline-color. Any excluded values will default to their initial value.

Value Description Example
[width]
(equivalent of single outline-width value)
  • Width is set explicitly.
  • Style defaults to none.
  • Color defaults to initial.
2px
[style]
(equivalent of single outline-style value)
  • Style is set explicitly.
  • Width defaults to medium.
  • Color defaults to initial.
solid
[color]
(equivalent of single outline-color value)
  • Color is set explicitly.
  • Width defaults to medium.
  • Style defaults to none.
red
[width] [style]
  • Width is set explicitly.
  • Style is set explicitly.
  • Color defaults initial.
2px solid
[width] [color]
  • Width is set explicitly.
  • Color is set explicitly.
  • Style defaults to none.
2px red
[style] [color]
  • Style is set explicitly.
  • Color is set explicitly.
  • Width defaults to medium.
solid red
[width] [style] [color]
  • Width is set explicitly.
  • Style is set explicitly.
  • Color is set explicitly.
2px solid red
inherit
initial
unset

Example


.mclaren { outline: 3px solid black; }

Browser support

Can I Use outline? Data on support for the outline feature across the major browsers from caniuse.com.