I have a simple list of li
elements that I want to count using the CSS counter()
function.
body {counter-reset: quantity}
ul li {counter-increment: quantity}
.sum:after {content: counter(quantity)}
<div class="mirror"></div>
<ul>
<li>..</li>
<li>..</li>
<li>..</li>
<li>..</li>
<li>..</li>
</ul>
<div class="sum"></div>
The problem is that counter should be at the end of the page (inside the .sum
- after all li
's it needs to count) but I need to present its value at the top of the page (inside the .mirror
or .mirror:after
).
I'm trying to find some jQuery solution but nothing works. I'm thinking that the problem is with taking value from the :after
pseudo-element.