I know it is possible to set an image instead of the HTML default bullets:
list-style-image: url(...);
But I havent\'t found a way how I ca
Just add a different class in the LI element
<ul class="navlist">
<li class="img_1">element1</li>
<li class="img_2">element2</li>
</ul>
<style>
.navlist li.img_1
{
padding-left: 10px;
background-image: url(images/image1.gif);
background-repeat: no-repeat;
background-position: 0 .5em;
}
.navlist li.img_2
{
padding-left: 10px;
background-image: url(images/image2.gif);
background-repeat: no-repeat;
background-position: 0 .5em;
}
</style>
you have to/can use classes in your list items:
<ul>
<li class="bar>
<a href="#" title="foo">Foo</a>
</li>
<li class="foo>
<a href="#" title="bar">Bar</a>
</li>
</ul>
CSS for images as bullets for <li>
ul {
list-style: none;
}
li {
padding-left: 25px; /*adjust to your needs*/
}
li.bar {
background: url(img_2.png) no-repeat 0 50%;
}
li.foo {
background: url(img_1.png) no-repeat 0 50%;
}
CSS for images as bullets for <a>
ul {
list-style: none;
}
li a {
padding-left: 25px; /*adjust to your needs*/
display: block;
}
li.bar a {
background: url(img_2.png) no-repeat 0 50%;
}
li.foo a {
background: url(img_1.png) no-repeat 0 50%;
}
HTML-
<ul>
<li>One</li>
<li>Two</li>
<li>Three</li>
</ul>
CSS(doesn't work on IE 7,8)-
ul li:nth-child(1){
list-style-image:url('image1.png');
}
ul li:nth-child(2){
list-style-image:url('image2.png');
}
ul li:nth-child(3){
list-style-image:url('image3.png');
}
CSS for all Browser including IE 7,8
ul li:first-child{
list-style-image:url('image1.png');
}
ul li:first-child + li{
list-style-image:url('image2.png');
}
ul li:first-child + li + li{
list-style-image:url('image3.png');
}
ul li:first-child + li + li + li{
list-style-image:url('image4.png');
}
You need to use nth-child
Property
CSS
li:nth-child(1){list-style-image:url(image)}
Here is the demo http://jsfiddle.net/5VB2u/
I think you can do this with classes
<li class="first"></li>
<li class="second"></li>
...
li.first {
⋮ declarations
}
li.second {
⋮ declarations
}
...
or the nth-child selector
li:nth-child(1) {
⋮ declarations
}
li:nth-child(2) {
⋮ declarations
}
...