Is it possible to use @counter-style on a pseudo-element?
I tried with an ::after, but it does not works, while in direct selector, @counter-style works. Problem with this case: if I want to move the element, it will move the whole <li> for me.
Otherwise, I'll have to add an element in my html to do what I want and that's a shame...
main .works ol li::after {
list-style: icone;
position: absolute;
}
@counter-style icone {
system: additive;
additive-symbols: V 5, IV 4, I 1;
}
<section class="works">
<h2>Fonctionnement</h2>
<ol>
<li>Choisissez un restaurant</li>
<li>Composez votre menu</li>
<li>Dégustez au restaurant</li>
</ol>
</section>
First, the problems; explanatory comments are in the code below:
To rectify the above problems, we remove the
maincomponent of the selector and we add an empty-string as a property-value for the declaredcontentproperty:Now that those issues are solved, the demo should...oh, it doesn't?
Well, that's because we also need to use a
counter():References:
@counter-style.counter().counter-increment.counter-reset.position.