views:

653

answers:

2

I am experiencing a problem with the following code in some versions of Internet Explorer:

#iconautente{ 
background-image:url('/style/images/spritecommon.png'); /*icona_utente.png*/
background-position:-117px -15px;
text-indent:-9000px;
width:20px;
height:23px;
display:inline-block;
}

<a id="iconautente" href="/admin/index.php">admin</a>

In Firefox, IE7 and IE8 under Vista, I see background and no text, as expected. In IE6 and IE8 under XP, the whole image is indented, not text, so the image is not shown.

What should be the right behavior? Is there a workaround?

+1  A: 

presumably internet explorer is not supporting display: inline-block; in versions below 7 and only partly in 7. Why don't you use display:block; ?

henchman
To be precise, `inline-block` is only supported in versions below 8 if the original `display` property is `inline`.
henasraf
original a tag is inline. Because with display:block; dont correctly vertical-align element, and vertical-align has no effect
Daniele Cruciani
A: 
* html #iconautente{text-indent:0; line-height:0; font-size:0; overflow:hidden}/*ie6 hack */

*:first-child+html #iconautente{ text-indent:0; line-height:0; font-size:0; overflow:hidden}/*ie7 hack */
Fatih Hayrioğlu
I just realized that font-size and line-height do the trick of not showing text ... thanx
Daniele Cruciani