Text-underline-offset property

Last updated: 2026-09-13

text-underline-offset Text-underline-offset property

The text-underline-offset CSS property sets the distance between an underline and the text baseline, making the underline position more flexible and polished. By default the underline hugs the bottom of the text; an offset leaves a gap so the line does not collide with descenders such as g and y.

Category
Initial Valueauto
InheritedYes
Applies To
Animation Type
CSS VersionCSS3
StatusStandard

📝 Syntax

text-underline-offset: auto | <length> | <percentage>;

⚙️ Values

ValueTypeDescription
autoKeywordDefault offset
<length> | <percentage>TypeThe underline offset distance as a length or percentage

▶ Example

Edit the code below and see the live result in the playground:

🌐 Browser Support

Browser ChromeChrome EdgeEdge FirefoxFirefox SafariSafari OperaOpera
text-underline-offset v66 v79 v62 v12.1 v53
Supported in all major browsers
Tip: text-underline-offset only affects the position of the underline; overlines and line-through are untouched.
Warning: It requires recent browser versions (Chrome 66+, Firefox 62+, Safari 12.1+); older browsers ignore the property.

❓ FAQ

QWhat is the difference between text-underline-offset and text-decoration-thickness?
Atext-underline-offset controls the distance between the underline and the text, while text-decoration-thickness controls how thick the underline is. They complement each other and can be combined for finer underline styling.
QWhat is the percentage value of text-underline-offset relative to?
AIt is relative to the element's font-size, where 100% equals the current font size. For example, with a 16px font size, text-underline-offset: 30% moves the line down about 4.8px. A value of 0 keeps the underline flush against the text bottom.
QHow do I create a gap between the underline and the text in CSS?
AOn top of text-decoration: underline, add text-underline-offset: 3px (or 0.2em) and the underline shifts downward as a whole. Pair it with text-decoration-thickness to also tune the weight and produce more polished link underlines.

📚 Related Tutorials

Web-Tutorial.com

Web-Tutorial Tech Team

A team of developers maintaining programming tutorials. Each tutorial is written and reviewed by developers with expertise in that field. We work to keep our content accurate and reliable — if you spot an issue, please let us know.

100%

🙏 帮我们做得更好

我们是刚上线的编程教程站,几个人的小团队,精力有限。页面虽经检查,难免还有疏漏——链接失效、排版错乱、内容有误、语言生硬……

如果您发现了,麻烦告诉我们,我们会在收到反馈后第一时间进行修复,再次感谢您的光临 🙏