Re: css3 :nth-child() WD

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 UTC