Lets say I have a simple list like so:
- one
- two
&l
The counters section in CSS 2.1 specifications contains various examples of how to implement your custom counter. Here is a very simple example where you:
.count
elements).custom-counter {
/* define a counter variable */
counter-reset: clumsycount 0;
/* style */
list-style-type: none;
}
.custom-counter .count {
/* increment the counter variable */
counter-increment: clumsycount 1;
/* style */
position: relative;
background-color: #EEE;
}
.custom-counter .count:before {
/* display the counter variable */
content: counter(clumsycount) ".";
/* style */
position: absolute;
top: 0;
right: 100%;
padding-right: .25em;
background-color: #CCC;
}
<ul class="custom-counter">
<li class="count">one</li>
<li class="count">two</li>
<li class="count">three</li>
<li class="count">four</li>
<li>blabla</li>
<li class="count">five</li>
<li class="count">six</li>
<li>blabla</li>
<li class="count">seven</li>
</ul>