HTML list with different images as bullets

后端 未结 5 1157
北恋
北恋 2021-01-19 07:06

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

5条回答
  •  长情又很酷
    2021-01-19 07:27

    HTML-

    • One
    • Two
    • Three

    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');
    }
    

提交回复
热议问题