25

Possible Duplicate:
HTML + CSS: Ordered List without the Period?

Want to remove dot "." from OL (order list)

<ol>
<li>One</li>
<li>Two</li>
</ol> 

Result

 1. One
 2. Two

Required Result

 1 One  
 2 Two
Community
  • 1
  • 1
The AV
  • 609
  • 3
  • 7
  • 17
  • 1
    See the answer [over here](http://stackoverflow.com/a/5945305/74757). Note, the technique doesn't work in older IE browsers. – Cᴏʀʏ Aug 14 '12 at 05:13

1 Answers1

46

This will work in IE8+ and other browsers

ol { 
    counter-reset: item;
    list-style-type: none;
}
li { display: block; }
li:before { 
    content: counter(item) "  "; 
    counter-increment: item 
}

or even:

ol li:before {
  content: counter(level1) " "; /*Instead of ". " */
  counter-increment: level1;
}

If you want older browsers to be supported as well then you could do this (courtesy neemzy):

ol li a {
    float: right;
    margin: 8px 0px 0px -13px; /* collapses <a> and dots */
    padding-left: 10px; /* gives back some space between digit and text beginning */
    position: relative; z-index: 10; /* make the <a> appear ABOVE the dots */
    background-color: #333333; /* same background color as ol ; the dots are now invisible ! */
}
Moin Zaman
  • 25,281
  • 6
  • 70
  • 74