Widely availableSupported across all major browsers. Safe to use in production.

Overview

The text-underline-offset CSS property shifts underlines on text from the initial position by a given distance. The initial position is affected by the text-underline-position property.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
87
87
70
12.1
87
12.2
auto
87
87
70
12.1
87
12.2
percentage

percentage values

87
87
74
18.2
87
18.2
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)

Syntax

CSS
a {
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-thickness: 2px;
}

a:hover {
  text-underline-offset: 2px;
}

Live demo

offset: 2px

text-underline-offset Offset: 2px demo.

PreviewFullscreen

offset: 6px

text-underline-offset Offset: 6px demo.

PreviewFullscreen

offset: 0.3em

text-underline-offset Offset: 0.3em demo.

PreviewFullscreen

Use cases

  • Using text-underline-offset

    The text-underline-offset CSS property shifts underlines on text from the initial position by a given distance. The initial position is affected by the text-underline-position property.

Cautions

  • May not be supported in older browsers.

Accessibility

  • Make sure visual changes are conveyed appropriately to assistive technology.

Powered by web-features