W3C home > Mailing lists > Public > www-style@w3.org > March 2001

Re: css3 :nth-child() WD

From: Jonas Sicking <sicking@bigfoot.com>
Date: Fri, 2 Mar 2001 17:28:31 +0100
Message-ID: <027d01c0a335$d23a3c80$5412a8c0@Milwork08>
To: "Tantek Celik" <tantek@cs.stanford.edu>, <www-style@w3.org>
Tantek Celik wrote:
> Thanks for the feedback Jonas.
>
> From: "Jonas Sicking" <sicking@bigfoot.com>
> Date: Wed, Feb 28, 2001, 1:55 PM
>
> > However I think the synax isn't very easy to read and also requires
three
> > psudos to match "child 3 to 5":
> > :nth-child(-n+5):not(:nth-child(-n+2))
>
> Just a quick correction on this, you actually only need _two_ pseudos:
>
>  :nth-child(n+3)   /* this selects children 3 onward */
>
>  :nth-child(-n+5)  /* this selects children before 5 inclusive */
>
> Thus:
>
>  :nth-child(n+3):nth-child(-n+5)  /* selects children 3 to 5  */
>
> I think this is fairly easy to read, and the even follows the logical
> semantic order of
>
>  "starting at child 3", and "select up through child 5"
>   (the first psuedo)         (the second pseudo)

Yes, sorry I got too focused on negative a : )
However you would still need a fairly large selector to make a style with
"tree lines white, tree lines gray, three lines white, tree lines gray ..."

TR:nth-child(6n+1), TR:nth-child(6n+2), TR:nth-child(6n+3) { ... }

versus

TR:nth-child(6n+1 to 3) { ... }

/ Jonas Sicking
Received on Friday, 2 March 2001 11:27:47 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 27 April 2009 13:54:08 GMT