Counting with CSS using CSS Counters

Simple counting with CSS, isn’t that awesome?


body {
	counter-reset: count;
}

li a:before {
	counter-increment: count;
	content: counter(count) ". ";
	font-weight: bold;
}

I needed to use something like this to count the <LI>s within an unordered list <UL> for a table of contents generated using jQuery. It’s simple, so there’s not too much to explain about it. It’s super handy though!