2

Is it possible to arrange the ol list numbers (2 digit numbers) to start from the left side.

Usually it comes like this

1
2
.
.
10
12

But I need that to show like this

enter image description here

Blender
  • 289,723
  • 53
  • 439
  • 496
Sowmya
  • 26,684
  • 21
  • 96
  • 136

2 Answers2

3

May be you can use counter -increment for this. Write like this:

ul{    counter-reset: chapter 0;  }
li:before{    
    counter-increment: chapter;    
    content:counter(chapter) ". ";
    width:20px;
    display: inline-block;
    text-align: right;   
}  

Check this http://jsfiddle.net/upc6b/

sandeep
  • 91,313
  • 23
  • 137
  • 155
0

You can use CSS counters:

CSS:

ol {
    padding-left: 40px;
    list-style: none;
    counter-reset: number;
}

ol li:before {
    display: inline-block;

    content: counter(number) '.';
    counter-increment: number;

    width: 30px;
}

The only problem with this approach is that the width of the number area is fixed, so it will not expand as the number of elements grows.

Demo: http://jsfiddle.net/Blender/UG5Y4/2/

Blender
  • 289,723
  • 53
  • 439
  • 496