When attempting to utilize different colors within the same HTML link, an issue arises where the underline is drawn with only a single color upon hovering over the link with the mouse.
The following HTML and CSS code is being used:
body {
background: #E7CEAF;
}
a {
color: white;
background: darkred;
text-decoration: none;
}
a:hover {
color: powderblue;
text-decoration: underline;
}
.tag {
font-style: italic;
color: yellow;
}
a:hover .tag {
text-decoration: none !important;
/* doesn't work */
}
This is some text: <a href="https://www.example.com"><span class="tag">[this is a tag] </span>This is a link, the tag being part of the link</a>
You can experiment with it on JSFiddle.
Upon inspection, it is evident that the underline remains blue even under the yellow words. How can I modify the styling of hovering links to display a yellow underline (or eliminate the line) under the yellow portion?