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

Re: css3 :nth-child() WD

From: Tantek Celik <tantek@cs.stanford.edu>
Date: Wed, 28 Feb 2001 15:20:27 -0800
To: Jonas Sicking <sicking@bigfoot.com>, www-style@w3.org
Message-ID: <1228720186-213569272@psdbay.com>
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)

Thanks,

Tantek

----------------------------------------------------------------------------
It is not the spoon that bends, it is only yourself.   microsoft.com/mac/ie/
Received on Wednesday, 28 February 2001 18:19:08 GMT

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