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.
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 |
- Available with a vendor prefix: -webkit- (9)
- Available with a vendor prefix: -webkit- (9)
Syntax
.clean-underline {
text-decoration: underline;
text-underline-position: under;
text-underline-offset: 3px;
} Live demo
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.
Related links
Powered by web-features