I am trying to make my list numbers look something like this:
Example
this is my current code for this:
CSS:
ul > ol > li::before > li::marker {
font-weight: 700;
position: absolute;
left: 160px;
content: counter(ol-counter);
counter-increment: ol-counter;
display: inline-flex;
align-items: center;
justify-content: center;
background-color: rgb(13, 89, 85);
color: white;
border-radius: 50%;
width: 30px;
height: 30px
}
HTML list:
<ul>
<li>
<ol>
<li>Bugatti Chiron Supersport 300+</li>
<br>
<li>Hennessey Venom F5</li>
<br>
<li>SSC Tuatara</li>
<br>
<li>Rimac Nevera</li>
<br>
<li>McLaren Speedtail</li>
<br>
<li>Koenigsegg Regera</li>
<br>
<li>Aston Martin Valkyrie</li>
<br>
<li>Pagani Huayra</li>
<br>
<li>Lamborghini Aventador SVJ</li>
<br>
<li>Koenigsegg Jesko Absolut (In theory it should be number 1.)</li>
</ol>
</li>
<ul>
why is this not working?
2
Answers
Your CSS is completely wrong. You´re not changing the style of anything.
li::before > li::marker
would select the::marker
of an<li>
, that is inside of the::before
of an<li>
. That makes no sense. I´d suggest you to read this reference on CSS selectors. For example, thats how I would select them in your case, if selecting the::before
and::marker
of each list element in the ordered list was your intention:I tried the below-mentioned code was working for me.