Example
nth childs:
:nth-child(-n+10)
it works here: link .
for more on understanding this check out this site .
I think if you want IE support, I can not make it more beautiful. At least I donβt know how with this cheap hack.
ul>li + li + li + li + li + li + li + li + li + li + li{ text-align: center; }β
http://jsfiddle.net/TzLqZ/ for an example of this above
Here is the IE path where the first 10 are centers and the last 2 are normal: http://jsfiddle.net/TzLqZ/3/
ol>li{ text-align: center; color: blue; } ol>li+li+li+li+li+li+li+li+li+li+li { text-align: left; color: red; }
source share