Set the offset distance of underline text decorations:
div.a {
text-decoration: underline;
}
div.b {
text-decoration: underline;
text-underline-offset: 10px;
}
div.c {
text-decoration: underline wavy blue;
}
div.d {
text-decoration: underline wavy blue;
text-underline-offset: 10px;
}
Try it Yourself »
The text-underline-offset
property specifies the offset distance of underline text decorations.
Default value: | auto |
---|---|
Inherited: | yes |
Animatable: | no. Read about animatable |
Version: | CSS4 |
JavaScript syntax: | object.style.textUnderlineOffset="1em" Try it |
The numbers in the table specify the first browser version that fully supports the property.
Property | |||||
---|---|---|---|---|---|
text-underline-offset | 87.0 | 87.0 | 70.0 | 12.1 | 73.0 |
text-underline-offset: auto|
length|
percentage|initial|inherit;
Value | Description | Play it |
---|---|---|
auto | Default value. The browser sets the appropriate offset for the underline | Demo ❯ |
length | Specifies the offset as a length value | Demo ❯ |
percentage | Specifies the offset as a percentage value | Demo ❯ |
initial | Sets this property to its default value. Read about initial | |
inherit | Inherits this property from its parent element. Read about inherit |
CSS tutorial: CSS Text Decoration
HTML DOM reference: textDecoration property
截取页面反馈部分,让我们更快修复内容!也可以直接跳过填写反馈内容!