The text-underline-position property controls where underlines are drawn — below text in horizontal layouts or beside text in vertical writing modes.
01
Placement
Where line sits.
02
auto
Browser picks.
03
under
Below text.
04
left / right
Vertical text.
05
Decoration
Needs underline.
06
Typography
Fine control.
Fundamentals
Introduction
The text-underline-position property in CSS allows web developers to control the position of underlines for text.
This property is particularly useful for fine-tuning the appearance of underlined text, especially in different writing modes and scripts. It can enhance readability and aesthetics by allowing more precise control over underline placement.
Definition and Usage
Use text-underline-position when default underlines collide with descenders (like “g” and “y”) or when vertical text needs the line on a specific side of the characters.
💡
Beginner Tip
For horizontal text, text-underline-position: under; with text-decoration: underline; keeps the line fully below the glyphs instead of crossing descenders.
Foundation
📝 Syntax
The syntax for the text-underline-position property is straightforward. It can be applied to any element containing text.
syntax.css
element{text-underline-position:value;}
Here, value can be one of several keywords that define the position of the underline.
The default value of the text-underline-position property is auto, which lets the browser decide the most appropriate position for the underline based on the font and text.
Cheat Sheet
⚡ Quick Reference
Question
Answer
Default value
auto
Underline below text
text-underline-position: under;
Vertical text, line on left
text-underline-position: left;
Requires underline
text-decoration: underline;
Pair with spacing
text-underline-offset
Inherited
Yes
Reference
💎 Property Values
The text-underline-position property accepts keyword values that define underline placement.
Value
Example
Description
auto
text-underline-position: auto;
The browser chooses the underline position based on the font and the text’s language.
under
text-underline-position: under;
The underline is placed below the text.
left
text-underline-position: left;
The underline is placed to the left of the text. This is used for vertical writing modes.
right
text-underline-position: right;
The underline is placed to the right of the text. This is used for vertical writing modes.
under left
text-underline-position: under left;
For vertical text, the underline is below the text and to the left.
autounderleftrightunder left
Context
When to Use text-underline-position
text-underline-position is the right choice when underline placement affects clarity:
Links with descenders — Use under so lines do not cut through letters like “g”.
Vertical layouts — Place underlines on left or right in vertical writing modes.
Multilingual sites — Let auto respect language-specific typography when appropriate.
Design systems — Standardize underline behavior alongside offset and thickness.
Preview
👀 Live Preview
Compare auto and under on text with descenders, plus vertical text with left:
auto Typography with jumping glyphs and descenders
under Typography with jumping glyphs and descenders
縦書きテキスト
Hands-On
Examples Gallery
In this example, we’ll change the underline position of some text to be below the text.
📜 Horizontal Text
Place underlines below text and compare with the browser default.
Example 1 — Underline positioned under the text
In this example, we’ll change the underline position of some text to be below the text.
index.html
<style>p{text-underline-position:under;text-decoration:underline;}</style><h1>Text with Custom Underline Position</h1><p>This is a paragraph with the underline positioned under the text.</p>
under keeps the line below descenders while text-underline-offset adds extra breathing room.
A11y
♿ Accessibility
Keep links identifiable — Position adjusts placement; do not remove underlines from links without another clear indicator.
Improve readability — under can help when thick underlines overlap letter shapes.
Test with real content — Verify descenders and multilingual text in your chosen typeface.
Combine with contrast — Use sufficient color contrast for underlines and link text.
Companion
position vs offset
text-underline-position chooses where the line is drawn (below, left, right). text-underline-offset moves it farther by a specific distance. Use both for precise control.
Apply text-decoration: underline on the text element.
Decoration
2
Position keyword is set
Choose auto, under, left, or right.
Placement
3
Browser draws the line
The underline appears on the chosen side relative to the text flow and writing mode.
Render
=
✅
Cleaner underlines
Text looks more polished with intentional underline placement.
Compatibility
Browser Compatibility
The text-underline-position property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.
✓ Modern browsers · Widely supported
Precise underline placement
Current Chrome, Firefox, Safari, Edge, and Opera support auto, under, and vertical-mode keywords.
95%Browser support
Google Chrome33+ · Desktop & Mobile
Full support
Mozilla Firefox52+ · Desktop & Mobile
Full support
Apple Safari12.1+ · macOS & iOS
Full support
Microsoft Edge79+ · All versions
Full support
Opera20+ · All versions
Full support
Testing tip
Vertical keywords like left and under left are most relevant with writing-mode: vertical-rl or vertical-lr.
text-underline-position property95% supported
Bottom line:text-underline-position: under; is widely supported for horizontal typography in modern browsers.
Wrap Up
Conclusion
The text-underline-position property is a valuable tool for web developers looking to refine the presentation of underlined text.
By customizing the position of underlines, you can enhance the readability and visual appeal of your text, especially in complex layouts and designs. Experiment with different values to see how this property can improve the typography on your web pages.