css – Add background image to
    numbers

css – Add background image to

    numbers

I would probably do something like this:

ol {
    list-style-position: inside;
    color: white;
}
ol li {

    background-image: url(nswCH.png);
    background-position: -5px;
    background-repeat: no-repeat;
    padding-left: 7px;
}

I would prefer in following way

 /* reset the ol counter with class liststyled*/
ol.liststyled {
counter-reset: item;
list-style-type: none;
list-style-position: inside;
padding-left: 0;
}
/* make the li relative */
ol.liststyled li{
position: relative;   
padding-left: 35px;
}
/*add absolute positioned img element background to our relative li */
ol.liststyled li:before{
font-size: .8em;
line-height: 25px;
vertical-align: middle;
width: 25px;
color: #fff;
text-align: center;
height: 25px;
content: counter(item)   ; 
counter-increment: item ;
position: absolute;
left: 0;
background: url(../img/bulletolback.png) center no-repeat;
}

css – Add background image to

    numbers

This seems the best way to me…. Customize Ordered Lists with the ::before Pseudo- Element

Leave a Reply

Your email address will not be published.