0

My link has below structure:

a{
  // some css here
}
a:before{
 // contains font icon
}
a:hover{
 text-decoration:underline;
}
a:hover:before{
 text-decoration:none;
}

I need to add text-decoration:underline only on hover of a link, not on the before part. My code is working perfectly fine on chrome but on IE 11, text-decoration:none is not working for a:hover:before.

Johanneke
  • 5,443
  • 4
  • 20
  • 33
maniac
  • 1
  • 1
  • 4

1 Answers1

0

What you can do is put the main content of the <a> in a span, and underline only the span.

a {
  text-decoration:none;
}
a:before {
 content: '➠ ';
}
a:hover span {                 /* changed */
 text-decoration:underline;
}
a:hover:before {
 text-decoration:none;
}
<a href="#"><span>Click here</span></a>
Mr Lister
  • 45,515
  • 15
  • 108
  • 150