The html is:
<div class="choose-os">
<p>
<a href="someLink" class="windows">Microsoft Windows</a>
<a href="someOtherLink" class="macos">Apple Mac OS</a>
</p>
</div>
The CSS is:
.choose-os {
margin: 20px 0;
padding: 20px;
background: #e7eefa;
}
.choose-os p {
margin: 0;
}
.choose-os p a {
display: inline-block;
text-indent: -100000px;
height: 56px;
width: 308px;
}
.choose-os p a.windows {
background: url(../images/button-windows-bg.png) 0 0;
}
.choose-os p a.macos {
background: url(../images/button-macos-bg.png) 0 0;
}
.choose-os p a:hover {
background-position: 0 -56px;
}
Any suggestions would be greatly appreciated as to have the background image also appear on IE7.
The
text-indent: -100000px;in combination withinline-blockis what’s causing the two elements to not be visible in IE7, due to a bug.You need to find some other way to hide the text for IE7 (or not use
inline-blockat all, see below for this more suitable fix).Options include the method in the comment by @Sotiris, or:
Which uses the
*property: valuehack several times to hide the text in IE7.The problem does seem to be related to the use of
display: inline-block.So, another workaround (which I prefer to my previous one) is: