Re: css3 :nth-child() WD

We could also adopt vixie cron notation, i.e. something like the following
(adapted from the chapter 5 crontab manpage):

1) You may put just a number, in which case it will match the nth field.
2) You may put an asterisk (*), which always stands for ``first-last''.
3) Ranges of numbers are allowed. Ranges are two numbers separated with a
   hyphen. The specified range is inclusive. For example, 8-11 specifies
   8, 9, 10 and 11.
4) Lists are allowed. A list is a set of numbers (or ranges) separated by
   commas.  Examples: ``1,2,5,9'', ``0-4,8-12''.
5) Step values can be used in conjunction with ranges. Following a
   range with ``/<number>'' specifies skips of the number's value
   through the range. For example, ``0-23/2'' can be used to specify
   ``0,2,4,6,8,10,12,14,16,18,20,22''. Steps are also permitted after an
   asterisk, so if you want to say ``every other tag'', just use ``*/2''.

I think this may be a bit clearer to use than the 6n+1 to 10 notation
proposed earlier.

Ian

On Fri, 2 Mar 2001, Jonas Sicking wrote:

> 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 12:05:20 UTC