仅使用CSS(2.1)完全可以做到:
ol.custom { list-style-type: none; margin-left: 0;}ol.custom > li { counter-increment: customlistcounter;}ol.custom > li:before { content: counter(customlistcounter) " "; font-weight: bold; float: left; width: 3em;}ol.custom:first-child { counter-reset: customlistcounter;}请记住,此解决方案依赖于:before伪选择器,因此某些较旧的浏览器(尤其是IE6和IE7)不会呈现生成的数字。对于这些浏览器,您需要添加一条额外的CSS规则,以仅使用常规列表样式的方式针对他们:
ol.custom { *list-style-type: decimal; }


