Forum How do I...?

Mirrored Counters

ollieman
I need to generate counters for h2 elements, but I need 2 counters for each (with the same value each). Like this:

36 Heading Two 36
37 Heading Two 37


My current code is:

h2:before {
	content: counter(h2);
	counter-increment: h2;
}
h2:after {
	content: counter(h2);
	counter-increment:h2;
}


This doesn't work because it adds a number for both generated items like this:

36 Heading Two 37
38 Heading Two 39


What am I missing? Is this supported?

Thanks in advance.
mikeday
Just remove the counter-increment on the :after.
ollieman
Thanks, that works great.