We're looking for a person or people to help audit MDN to find places we could speed up. Is this you or someone you know? Check out the RFP: https://mzl.la/2IHcMiE

The outline CSS property is a shorthand for setting various outline properties in a single declaration: outline-style, outline-width, and outline-color.

As with all shorthand properties, any omitted sub-values will be set to their initial value.

Borders vs. outlines

Borders and outlines are very similar. However, outlines differ from borders in the following ways:

  • Outlines never take up space, as they are drawn outside of an element's content.
  • According to the spec, outlines don't have to be rectangular, although they usually are.


/* style */
outline: solid;

/* color | style */
outline: #f66 dashed;

/* style | width */
outline: inset thick;

/* color | style | width */
outline: green solid 3px;

/* Global values */
outline: inherit;
outline: initial;
outline: unset;

The outline property may be specified using one, two, or three of the values listed below. The order of the values does not matter.

Note: The outline will be invisible if its style is not defined. This is because the style defaults to none.


Sets the color of the outline. Defaults to currentcolor if absent. See outline-color.
Sets the style of the outline. Defaults to none if absent. See outline-style.
Sets the thickness of the outline. Defaults to medium if absent. See outline-width.

Formal syntax

[ <'outline-color'> || <'outline-style'> || <'outline-width'> ]



<a href="#">This link has a special focus style.</a>


a {
  border: 1px solid;
  border-radius: 3px;
  display: inline-block;
  margin: 10px;
  padding: 5px;

a:focus {
  outline: 4px dotted #e73;
  outline-offset: 4px;
  background: #ffa;


Accessibility concerns

Assigning outline a value of 0 or none will remove the browser's default focus style. If an element can be interacted with, it must have a visible focus indicator. Provide obvious focus stlying if the default focus style is removed.


Specification Status Comment
CSS Basic User Interface Module Level 3
The definition of 'outline' in that specification.
Proposed Recommendation No change.
CSS Level 2 (Revision 1)
The definition of 'outline' in that specification.
Recommendation Initial definition.
Initial valueas each of the properties of the shorthand:
Applies toall elements
Mediavisual, interactive
Computed valueas each of the properties of the shorthand:
  • outline-color: For the keyword invert, the computed value is invert. 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).
  • outline-width: an absolute length; if the keyword none is specified, the computed value is 0
  • outline-style: as specified
Animation typeas each of the properties of the shorthand:
Canonical orderorder of appearance in the formal grammar of the values

Browser compatibility

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support1 Yes


1 —? -moz-

FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support1 ? Yes473.1 ?

1. Firefox includes absolutely positioned elements inside the outline (see bug 687311).