I want to do some image replacement on the span so we can have a nice icon for the visual design but keep the header (telephone, web…) so screen readers, css-off.
Using my normal image replacement method of text-indent: -5000px isn’t working however…
Anyone have any idea’s why? It works on the paragraphs but not the spans inside them :<
As Zcorpan already pointed out you can’t use text-indent on inline elements but you could float the span and then the text-indent would take effect because it then becomes a block level box of sorts.
I should point out the IE will allow text-indent to work on spans (even though it shouldn’t) and that ie5.+ will also indent the backgrounds as well meaning that the images you are replacing the text with will also disappear and your viewers in those browsers will get nothing.
Well - I have fixed it as such, probably some browser it won’t work in some place but it works for the ones we are targetting ;>
float: left; - so it aligns to the side of the text if refers to
display: block; - so I can use text indent
width: 16px; - so it has a fixed dimension
overflow: hidden; - so the text doesn’t show up
text-indent: 20px; - to move the text out the way
background: url(images/telephone.gif) top left no-repeat; - to put the image in!