How To Fix List-Style-Image bug in IE
Have you experienced IE’s crocked rendering of list-style-images? Either they don’t display at all or are chopped in half (choose how much here! – LOL), especially when you’re floating a list beside an image. Or how about the annoying IE "peek-a-boo" bug, hiding and re-appearing indiscriminately.
Anyway, I found a solution: First I created a class ul.list for the unordered list.
Clear the list-style-type to none, remove all margins and padding. This makes it cross-browser compatible.
ul.list
{
list-style-type:none;
padding:0;
margin:0;
}
Then I created a rule for the .li
ul.list li
{
margin-left:40px;
background-image:url(../images/arrow.gif);
background-repeat:no-repeat;
background-position:0 6px;
padding-left:22px;
}
Indent the left and right margins about 10px narrower than your header and paragraph margins.
Use a background-image instead of a list-style-image. You will have to adjust the background-position through trial and error so it lines up beside the text.
As for the padding: If your background-image is 16px in width, make the padding the width of the image plus about 6px, for a total of 22px. The extra px for padding will depend on your personal tastes as far as white-space between the image and the text happen to be.
<ul class=”list”>
<li> Item One</li>
<li> Item Two</li>
<li> Item Three</li>
<li> Item Four</li>
</ul>
You can also do this for "nested lists" indenting the margin by only 10px instead of the 40px as in the demonstration.
About the author. Claire Poulton is a professional web designer. I design my sites using ONLY CSS and PHP, no tables, no WYSYWIG editor. Visit my design site at Tygerz Designs
No Comments »
Leave a Reply
You must be logged in to post a comment.





