Slide 5.10: CSS lists
Slide 5.12: CSS lists (cont.)
Home

CSS Lists (Cont.)


An Image as the List Item Marker
To specify an image as the list item marker, use the list-style-image property:
   ul { list-style-image: url('lamp.gif'); }
The example above does not display equally in all browsers. IE and Opera will display the image-marker a little bit higher than Firefox, Chrome, and Safari. If you want the image-marker to be placed equally in all browsers, a crossbrowser solution is explained below.

Crossbrowser Solution
The following example displays the image-marker equally in all browsers:
        ul {
         list-style-type: none;
         padding: 0px;
         margin: 0px; }

        li {
         background-image: url(lamp.gif);
         background-repeat: no-repeat;
         background-position: 0px 5px;
         padding-left: 14px; }

Demonstration
The following demonstration shows how the script of HTML and CSS is displayed on the Web: