Briefly
The text
property controls the appearance of underlines and overlines. If the text needs to be struck through, the text
property will be ignored.
How it is written
Possible values:
none
— the line is drawn under the text through the glyphs;auto
— the line may be drawn so that it does not touch the glyphs (default value);all
— the line will be drawn, without touching the glyphs.
Example
Let’s create a few paragraphs of text. We will apply the text
property to them along with the text
property with different values.
a { text-decoration: underline;}
a { text-decoration: underline; }
a { text-decoration: overline;}
a { text-decoration: overline; }
Tips
💡 text
works only together with text
.
If you write
p { text-decoration-skip-ink: auto;}
p { text-decoration-skip-ink: auto; }
text
will be applied, but it will not work correctly.
To avoid this, you need to modify the code above slightly:
p {+ text-decoration: underline; text-decoration-skip-ink: auto; }
p { + text-decoration: underline; text-decoration-skip-ink: auto; }
💡 text
will not work correctly when using text
because the line will appear over the highest glyph of the text.