Accessibility

CSS Advisor

IE List-style image not clearing

by jxlusa on September 18, 2009 Avg Rating Not yet rated   |   Log in to rate post.

Tagged with list-style , Explorer 6.0 , Explorer 8.0 , bullet images , Explorer 7.0 , list-style-image

Problem

Globally defined list-style-image shows up in IE where a specific list is given list-style:none.

Solution

Recommended Solution: Add list-style-image:none; to the specific selector.

Detailed description

IE List-style image does not clear

Every browser except IE will clear a defined list style image when the specific list is given list-style:none;
Internet Explorer, Including IE8, will show the list bullet image anyway - unless you specifically clear it using list-style-image: none;

Why you care:

You want all lists in a page except the menu (for example) to use a custom bullet image but the image insists on showing up even in the lists you told it not to.
See the attached gif screenshots (below) for 2 examples of what you want (and actually get in most browsers) verses what you get in IE.

Example

(Generally, this becomes a point of confusion when you are using css shorthand, but for clarity, I will give a long-hand examples first.)

This will clear the list bullet image in most browsers, but not IE:

  <style type="text/css">
ul li {
   list-style: square;
   list-style-image: url(li.png);
}

ul.menu li {
   list-style: none;
}
  </style>

This works cross-browser:

  <style type="text/css">
ul li {
   list-style: square;
   list-style-image: url(li.png);
}

ul.menu li {
   list-style: none;
}
  </style>

Shorthand Examples

This will clear the list bullet image in most browsers, but not in IE:

ul li {
list-style: square outside url(li.png);
}

ul.menu li {
list-style: none outside none;
}

This works cross-browser:

ul li {
list-style: square outside url(li.png);
}

ul.menu li {
list-style: none outside none;
}

Note:
Not tested on IE browsers prior to IE6.

want.gif
get.gif
want-simplified.gif
get-simplified.gif




Text ID: IELISTSTYLEIMAGE



Comments (1)

To add a comment, please Log in.




IE List-style image does not clear

I don't see any diffrence in the code





CSS Advisor home
Submit a post

rss

CSS ADVISOR RSS FEEDS
Recent: POSTS | COMMENTS | EDITS


Browsers
Internet Explorer (45)
Mozilla/Firefox (16)
Opera (7)
Safari (13)
CSS Properties
Background (6)
Border (3)
Color (1)
Float (15)
Font (1)
Margin (6)
Padding (4)
Position (15)
Text (13)
Width/Height (9)