Reputation: 168
I have the following html:
<a href="..."><span>ICON</span>Text</a>
How can I remove only the "Text" using CSS rules? NOTE: I need to continue to see the content.
Upvotes: 2
Views: 863
Reputation: 18113
Based on Paulie_D's answer, I came with a solution by using font-size
:
a {
font-size: 0;
}
a span {
font-size: 16px;
}
Based on the comments on this answer, I think this might be the solution. It isn't perfect, but will do. We use my answer with the font-size: 0
. Like Paulie_D commented this won't work crossbrowser, some browser will show it in a font-size of 4px. For those browser we add Paulie_D's solution too:
a {
font-size: 0;
visibility:hidden;
}
a span {
font-size: 16px;
visibility:visible;
}
To see the difference between the two: check here.
Upvotes: 4
Reputation: 114991
You can use visibility
for this
CSS
a {
visibility:hidden;
}
a span {
visibility:visible;
}
Upvotes: 6