10 09/2014

color ol list num with css

最后更新: Wed Sep 10 2014 12:29:11 GMT+0800

I want the ordered list(OL) num show different color.

method 1 : with css3 counter

ol {
    margin: 10px 0;counter-reset:item;    
}
ol li:before {content:counter(item)+'.';counter-increment: item;
        color: red;display: inline-block;margin-right: 8px;font-size:1.3em;font-style: italic;}

method 2

<li style='color: red;'><span style='color:black;'>test</span></li>

method 3 : with jquery

$('ol li').each(function(j,k){$(k).prepend(''+(j+1)+' ')})

marker

css ::marker will solve this problem either.But no Bowser support NOW!