outline-offset property

Image Tutorials

Definition and Usage

The outline-offset CSS property is used to set space between an outline and the edge or border of an element. An outline is a line that is drawn around elements, outside the border edge.

  • Initial0
  • Applies toall elements
  • Inheritedno
  • Mediavisual, interactive
  • Computed Valueas specified, but with relative lengths converted into absolute lengths
  • Animatableyes, as a length
  • Canonical orderthe unique non-ambiguous order defined by the formal grammar

The space will be transparent (the parent will determine the background).


Syntax

Formal syntax: <length>
outline-offset: 3px
outline-offset: 0.2em
outline-offset: inherit

Values

<length>
The width of the space. See <length> for possible units. Negative values place the outline inside the element.

Examples

1 .example {
2   outlinedashed thin;
3   /* Move the outline 3px away from the border */
4   outline-offset: 3px;
5 }

Result:

outline: offset 5px;

outline: multiple offsets;


Compatibility

Desktop browsers

Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari (WebKit)
Basic support 1.0 1.5 (1.8) Not supported 9.5 1.2 (125)

Mobile browsers

Feature Android Firefox Mobile (Gecko) IE Phone Opera Mobile Safari Mobile
Basic support NA NA NA NA NA
Rate article