[ACCEPTED]-Styling the first 10 items in a list-css
nth childs example:
:nth-child(-n+10)
this in works here: link.
more 6 on understanding this check out this site.
I 5 guess if you want IE support, i can't really 4 make this any prettier. Atleast I don't 3 know how with this cheap hack.
ul>li + li + li + li + li + li + li + li + li + li + li{
text-align: center; /*makes everything after 10 centered*/
}
http://jsfiddle.net/TzLqZ/ for an example 2 of this above
Here is the IE way with first 1 10 being center and the last 2 being 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;
}
I think you are looking for the nth child 8 pseudo-selector seen here http://css-tricks.com/how-nth-child-works/ I think for what 7 what you want to do:
select all but top ten:
ul li:nth-child(n+11){}
or 6 just top ten:
ul li:nth-child(-n+10){}
should do the trick.
However, Internet 5 Explorer does not support this at least until 4 ie8 according to the article. So don't rely 3 on it for anything critical (although I 2 don't know what child specific styling would 1 be critical).
More Related questions
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.