Is it possible to underline an anchor tag with a color other than its text color? Any example will be appreciated.
EDIT: Is it possible to specify color as hex e.g. #8f867c ?
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.
Change the underline style and color Select the text that you want to underline. Tip: You can also use the keyboard shortcut Ctrl+D. Use the Underline style drop-down list to select an underline style. Use the Underline color drop-down list to change the color of the line.
Complete HTML/CSS Course 2022 To change the color of links in HTML, use the CSS property color. Use it with the style attribute. The style attribute specifies an inline style for an element. Use the style attribute with the CSS property color to change the link color.
CSS3 allows you to use text-decoration-color: #8f867c
to set the color directly.
p {
color: green;
text-decoration: underline;
text-decoration-color: #8f867c;
}
span {
color: #8f867c;
}
<p>My underline is <span>#8f867c</span></p>
You cannot specify the underline color separately, but you can use a little trick:
a {
color: red;
text-decoration: none;
border-bottom: 1px solid green;
}
Note that the border will not appear exactly where the underline would have appeared, sorry.
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