CSS Portal

CSS outline-offset Property

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
outline-offset
CSS PropertyThis property is supported by all modern browsers.
Updated 1st January 2026

Description

The outline-offset property shifts an element's outline away from or toward the element's border edge, creating a visible gap (or overlap) between the outline and the element itself. Because outlines are painted outside the element's box and do not contribute to the box model, adjusting that offset changes only the visual spacing; it does not affect layout, element size, or document flow. This makes the property particularly useful when you need decorative or accessibility-focused indicators that must remain visually distinct without altering surrounding layout.

You can use outline-offset together with the element's outline settings to control how that indicator sits relative to borders and adjacent content. It complements the element's outline (which controls the outline’s style, color and width) and the element's border (which is part of the box model). Keep in mind that outlines are painted and composited differently than borders and shadows: they may be clipped by container clipping and can render in subtly different ways across implementations, so visual testing in context is recommended.

Practically, designers rely on outline-offset for clearer focus rings and layered effects - letting a focus outline sit outside an existing border or move closer to the element for tighter highlighting - without causing reflow. If you need a softer, blurred, or inset effect that interacts with stacking and painting differently, consider using box-shadow instead. Also be mindful that outlines are painted over nearby content when they extend beyond the element, so choose offsets carefully to avoid unintended overlaps.

Definition

Initial value
0
Applies to
All elements
Inherited
No
Computed value
[length] value in absolute units (px or physical)
Animatable
No
JavaScript syntax
object.style.outlineOffset

Interactive Demo

The rusty swing set creaked a lonely lullaby in the twilight, shadows lengthening like grasping fingers across the dew-kissed grass. A lone dandelion seed, adrift on the breeze, whispered secrets of faraway fields, of dandelion suns and galaxies spun from fluff.

Syntax

outline-offset: <length> | inherit

Values

  • <length>Floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px).
  • inherit

Example

<div class="container">
<div class="styled-box">
Outline Offset Example
</div>
</div>
/* Container for centering the example */
.container {
  display: flex;
  justify-content: center;
  align-items: center;
  height: 200px;
}

/* The actual element with the offset */
.styled-box {
  padding: 20px;
  background-color: #f0f4f8;
  border: 2px solid #2d3748; /* The solid inner border */
  
  /* Outline properties */
  outline: 4px dashed #ed8936; /* The dashed outer line */
  
  /* This is the key property */
  outline-offset: 15px; 
  
  font-family: sans-serif;
  font-weight: bold;
}
Open in editor

Browser Support

The following information will show you the current browser support for the CSS outline-offset property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee