When an a
tag contains child elements, like an i
tag, it\'s still applying the underline to it on hover, and I\'m wondering how to remove the under
Try following css,
a:hover i{
display: inline-block; <-- this is the trick
text-decoration:none !important;
}
Demo
I had the same issue and fixed this using the following css rule:
a:-webkit-any-link {text-decoration:none}
hope it helps!
Set the display
property of i
to inline-block
:
a i {
...
display: inline-block;
}
JSFiddle
Simply add display:inline-block;
FIDDLE DEMO
a:hover i {
display:inline-block;
text-decoration:none !important;
}
You can also write you HTML like
<a href="#">Link</a><i>(2)</i>
and CSS like
a{
display:inline-block;
text-decoration:none;
}
I faced the same problem.
But I wanted the inner element to be Right,
so setting just float: right
worked fine.
a {
display: block;
overflow: hidden; // Clearfix
text-decoration: none;
}
a .right-none-underline-element { float: right }
For your reference.