Solution (Conditional Comments Solutions)
Date of the Solution
Sun Jul 19 13:38:22 2009
Fixed Versions
all of the affected
Description
Floats to the rescue! Let's look at the fixed demo:
- HTML Code:
<ul>
<li><a href="#">one</a></li>
<li><a href="#">two</a></li>
<li><a href="#">three</a></li>
<li><a href="#">four</a></li>
</ul>
- CSS Code:
li {
border: 1px solid #fff;
}
a {
background: #f00;
display: block;
overflow: hidden;
}
- Conditional Comments:
<!--[if IE 8]>
<style type="text/css">
a {
float: right;
width: 100%;
}
</style>
<![endif]-->
Floating the ' element"><a>
elements fixes the bug. Note that float
is set to right
, not left
; if we use left
, the bullets of the list end up on the wrong side... fun huh? We also use width
property to make our ' element"><a>
elements remain their width
; 100%
is not exactly the same as auto
, but try to improvise if you have padding/borders set. The reason for conditional comments is that IE8 seems to contain floated ' element"><a>
elements just fine without extra code, as opposed to other browsers; you may want to play around with this.
Note: setting list-style
to none
also fixes the bug, if that's fine by you, do that instead.