Simple example
Fiddle : http://jsfiddle.net/63pc4y57/1/
HTML
<div>one</div>
<div>two</div>
<div>three</div>
CSS
body
{
counter-reset: divs;
}
div
{
background: grey;
color: black;
height: 5em;
line-height: 5em;
margin-left: 2em;
width: 5em;
counter-increment: divs;
position: relative;
}
div:before
{
background: lightgrey;
content: counter(divs);
left: -1em;
position: absolute;
width: 1em;
}
If you can use the numbers inside the div
's then remove position: absolute
and add display: inline-block
on div:before
their width will be taken into account