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

Overview

The text-underline-position CSS property sets the position of underlines on text. For example, text-underline-position: under places the underline below the text, avoiding crossing descenders. The underline may be further adjusted by the text-underline-offset property.

Browser support

Feature Desktop Mobile
Chrome
Edge
Firefox
Safari
Chrome Android
Safari iOS
33
12
74
12.1
33
12.2
auto
33
79
74
12.1
33
12.2
from-font
87
87
74
12.1
87
12.2
left
71
79
74
18.2
71
18.2
right
71
79
74
18.2
71
18.2
under
33
79
74
12.1
33
12.2
1+Supported (version) Not supported Has note Sub-feature descriptions sourced from MDN Web Docs (CC BY-SA 2.5)
Notes 1 item(s)
Compatibility
  • Available with a vendor prefix: -webkit- (9)
Notes 1 item(s)
Compatibility
  • Available with a vendor prefix: -webkit- (9)

Syntax

CSS
.clean-underline {
  text-decoration: underline;
  text-underline-position: under;
  text-underline-offset: 3px;
}

Live demo

Auto(default)

CSS Auto(default) demo.

PreviewFullscreen

Under(character. bottom)

CSS Under(character. bottom) demo.

PreviewFullscreen

under + offset

CSS Under + offset demo.

PreviewFullscreen

Use cases

  • Using text-underline-position

    The text-underline-position CSS property sets the position of underlines on text. For example, text-underline-position: under places the underline below the text, avoiding crossing descenders. The underline may be further adjusted by the text-underline-offset property.

Cautions

  • May not be supported in older browsers.

Accessibility

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

Powered by web-features