View video tutorial

CSS Outline Offset

CSS

This property adds space between an outline and the border.

CSS outline-offset property

➔ The outline-offset property is used to add space between an outline and the border of an element.

Syntax

outline-offset: length|initial|inherit;

Property values

Common Value Description
length Set the amount of space between an element's outline and its border edge.
initial Sets the property to its default value.
inherit The element inherits the property value from its parent element.

Example

.p1 {
  outline-width: 5px;
  outline-style: solid;
  outline-color: red;
  outline-offset: 1px;
  border: 2px solid black;
}
.p2 {
  outline-width: 5px;
  outline-style: solid;
  outline-color: #32b853;
  outline-offset: 5px;
  border: 2px solid black;
}
Try it Now »

Click on the "Try it Now" button to see how it works.