I want to color the text decoration. I got a tutorial from w3schools
And tried this
text-decoration: underline;
text-decoration-color: #dddddd;
But it is not working. Is this not valid? Is there any other way to color the underline?
4. Which of the following is not used with text-decoration property? Explanation: overline, underline, line-through properties are used to decorate the text. it will produce headings h1 with text having line-through, h2 with text having overline and h3 with text having underline.
The text-decoration-color CSS property sets the color of decorations added to text by text-decoration-line . The color applies to decorations, such as underlines, overlines, strikethroughs, and wavy lines like those used to mark misspellings, in the scope of the property's value.
Change the underline to dots with the border-bottom style property a { text-decoration: none; border-bottom:1px dotted; }. Change the underline color by typing a { text-decoration: none; border-bottom:1px solid red; }. Replace solid red with another color.
Underline tag: To change the color of the underline, we need to add some styling using CSS (inline/internal/external). By default, the color of the underline is black. In CSS, we will use text-decoration property to style underline.
text-decoration-color
has minimal browser support
Instead, you can use something like a span to re-colour your text:
p {
color: red; /* colour of underline */
text-decoration: underline;
}
span {
color: black; /* original colour of p */
}
<p><span>underline is red, text is black</span></p>
Your code is likely to affect another class
p {
text-decoration: underline;
text-decoration-color: red!important;
}
<p>test</p>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With