CSS text-underline-offset Property
Example
p {
text-decoration: underline;
text-underline-offset: 1em;
}
Hello World!
Meaning:
The text-underline-offset CSS property sets the offset distance of an underline text decoration line (applied using text-decoration) from its original position.
Note: text-underline-offset is not part of the text-decoration shorthand. While an element can have multiple text-decoration lines, text-underline-offset only impacts underlining, and not other possible line decoration options such as overline or line-through.
Default value: | auto |
Inherited: | Yes |
Animatable: | No |
Version: | CSS3 |
JavaScript syntax: |
|
Standard Syntax
text-underline-offset: auto|length|percentage|initial|inherit|revert|revert-layer|unset;
Browser Support
Status
Property Values
The following table describes the values of this property:
Value | Description |
---|---|
auto | The browser chooses the appropriate offset for underlines. |
length | Specifies the offset of underlines as a length, overriding the font file suggestion and the browser default. It is recommended to use em units so the offset scales with the font size. |
percentage | Specifies the offset of underlines as a percentage. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
text-underline-offset: auto;
}