Solution (Clean Solution)
Date of the Solution
Thu Aug 13 08:33:38 2009
Fixed Versions
All of the affected
Description
Since this bug affects other browsers and even the "bugless" version of rendering is a bit unpleasant to the eye (i.e. the bullet is below the image instead of being at the top) I think the solution I am about to propose, despite requiring an extra HTTP request, is quite reasonable and provides consistent rendering across browsers:
- HTML Code:
<ul>
<li class="one">
<img src="hl_logo.png" width="95" height="115" alt=""> Lorem Ipsum
</li>
</ul>
<ul>
<li class="two">
<img src="hl_logo.png" width="95" height="115" alt="">
<p>Lorem Ipsum</p>
</li>
</ul>
<ul>
<li class="three">
<img src="hl_logo.png" width="95" height="115" alt="">
<p>Lorem Ipsum</p>
</li>
</ul>
- CSS Code:
li {
list-style: none;
overflow: hidden;
width: 500px;
background: url(disc.gif) no-repeat left .5em;
padding-left: 1em;
}
.one img, .two img{
float: left;
}
.three img {
float: right;
}
The idea of the fix is to remove the "native" bullet and use an image instead. Since the positioning of list-style-image
is quite inconsistent across browsers, I've used the image as background
on the ' element"><li>
elements. The top position of the background "bullet" is set in em
units and I also added padding-left
(and set em
value) to offset our content away from the "bullet". Works for me!