For example:-
HTML Code
<div> <h1><span class="title-icon">icon</span> Hello India!</h1> </div>
CSS Code
h1{ } h1 span{ background: url("../images/icon.png") text-indent: -9999px; width:24px; height:24px; margin-right:1em; }
text-indent
doesn't work on inline
elements. <span>
defaults to being inline
. You need to change it so it works as an inline block:
display:inline-block;
Try setting font-size
to zero
:
h1 span { background: url("../images/icon.png") font-size: 0; width: 24px; height: 24px; margin-right: 1em; }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With