📄 tailwindcss/docs/outline-offset

File: outline-offset.md | Updated: 11/15/2025

Source: https://tailwindcss.com/docs/outline-offset

v4.1

⌘KCtrl KDocs Blog Showcase Sponsor Plus

  1. Borders
  2. outline-offset

Borders

outline-offset

Utilities for controlling the offset of an element's outline.

| Class | Styles | | --- | --- | | outline-offset-<number> | outline-offset: <number>px; | | -outline-offset-<number> | outline-offset: calc(<number>px * -1); | | outline-offset-(<custom-property>) | outline-offset: var(<custom-property>); | | outline-offset-[<value>] | outline-offset: <value>; |

Examples


Basic example

Use utilities like outline-offset-2 and outline-offset-4 to change the offset of an element's outline:

outline-offset-0

Button A

outline-offset-2

Button B

outline-offset-4

Button C

<button class="outline-2 outline-offset-0 ...">Button A</button><button class="outline-2 outline-offset-2 ...">Button B</button><button class="outline-2 outline-offset-4 ...">Button C</button>

Using a custom value

Use the outline-offset-[<value>] syntax to set the outline offset based on a completely custom value:

<div class="outline-offset-[2vw] ...">  <!-- ... --></div>

For CSS variables, you can also use the outline-offset-(<custom-property>) syntax:

<div class="outline-offset-(--my-outline-offset) ...">  <!-- ... --></div>

This is just a shorthand for outline-offset-[var(<custom-property>)] that adds the var() function for you automatically.

Responsive design

Prefix an outline-offset utility with a breakpoint variant like md: to only apply the utility at medium screen sizes and above:

<div class="outline md:outline-offset-2 ...">  <!-- ... --></div>

Learn more about using variants in the variants documentation .

On this page

Copyright © 2025 Tailwind Labs Inc.·Trademark Policy