# outline-offset

> The `outline-offset` CSS property sets the space between an outline and the edge of an element's border box.

## How do I add space between an element and its focus outline?

The property that sets the space between the outline and the edge of the element's border box. It controls how far the outline is drawn from the element.

- Topic: Borders, Outlines & Shadows
- Type: property
- Browser support: Chrome 1+, Chrome Android 18+, Edge 15+, Firefox 1.5+, Firefox Android 4+, Safari 1.2+, Safari iOS 1+

## Example

Wrong:

```css
.gallery {
  overflow: hidden;
}
.gallery a:focus-visible {
  outline: 2px solid;
}
```

Right:

```css
.gallery {
  overflow: hidden;
}
.gallery a:focus-visible {
  outline: 2px solid;
  outline-offset: -2px;
}
```

A negative offset draws the ring inside the link, so the parent's `overflow: hidden` no longer cuts it off.

## Common mistakes

- The focus ring is cut off by a parent with `overflow: hidden`.
- Expecting `outline-offset` to change layout or spacing around the element.

## Key points

- Focus rings use a positive `outline-offset` so they don't touch the element's edge.
- Elements inside `overflow: hidden` parents use a negative `outline-offset` so the ring isn't clipped.

## Interview questions

### Can outline-offset be negative?

Yes. A negative value draws the outline inside the element's border box.

### Does outline-offset affect layout?

No. Outlines and their offset never change the size or position of any element.

### What is the default outline-offset?

'0', so the outline is drawn right at the edge of the border box.

## Related cards

- [outline](https://wonderium.dev/css/outline.md)
- [:focus-visible](https://wonderium.dev/css/focus-visible.md)
- [overflow](https://wonderium.dev/css/overflow.md)
- [Focus Appearance](https://wonderium.dev/a11y/focus-appearance.md)
- [outline-width](https://wonderium.dev/css/outline-width.md)

---

- Level: [CSS](https://wonderium.dev/css.md)
- HTML version: https://wonderium.dev/css/outline-offset
- Last updated: 2026-11-25
