I have an HTML ordered list with a structure something like this.
<ol>
<li class="myclass"> First Element
</li>
<li class="myclass"> First Element
</li>
<li class="myclass"> First Element
</li>
</ol>
I wanted to add a background colour to list numbers 1,2,3. I found ::marker
selector available in CSS. But, then I was able to use this ::marker
selector to change the color of the font, but I'm unable to change the background-color.
.myclass::marker {
color: red;
}
The background-color property doesn't seem to work inside ::marker
selector. Is there any work around?
Edit:
I'm looking to have a design similar to this numbering background