I can't figure out an elegant way to accomplish the following using CSS:
I need the numbers of the ordered list to have the teal bubble-looking background. I have this image (which includes the white stroke):
But I can't figure out how to put it behind each of the numbers using CSS. Thanks.
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;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With