Reputation: 199
I'm using FontAwesome in span:after. It working fine in chrome but not working in IE.
<label><span class="sptxt">Hello</span></label>
.sptxt:after{
font-family: FontAwesome;
content: "\ea28";
text-decoration: inherit;
position: absolute;
font-size: 80px;
color: inherit;
margin: 0px 0 0 4px;
z-index: 1;
visibility: visible;
}
.sptxt{visibility:hidden;}
In the above code, I want hide the text "Hello" in span. FontAwesome icon has to be displayed in span. I want to replace "Hello" word with FontAwesome icon. It works as expected in Chrome but not in IE.
Upvotes: 0
Views: 148
Reputation: 56
I would do with text-indent instead of visibility.
.element {
position: relative;
text-indent: -9999px;
display: block;
}
.element:after{
content: "\f000";
font-family: FontAwesome;
text-decoration: inherit;
position: absolute;
font-size: 30px;
color: inherit;
z-index: 1;
left: 9999px;
}
Upvotes: 1
Reputation: 24
You can use either span
or i
tag for fontawesome. But here you are using span
to display the content Hello so you can use i
tag for fontawesome.
<label><span class="sptxt"><i></i>Hello</span></label>
Upvotes: 0