CSS text-decoration underline color

Wizard picture Wizard · Oct 9, 2012 · Viewed 272.1k times · Source

Possible Duplicate:
Changing Underline color

It's possible to change only line color which is under text? I would like to see something like red letters with a blue line below it, but I can't find out how to get this done.

Answer

Cherusker picture Cherusker · Oct 9, 2012

You can do it if you wrap your text into a span like:

a {
  color: red;
  text-decoration: underline;
}
span {
  color: blue;
  text-decoration: none;
}
<a href="#">
  <span>Text</span>
</a>