W3C home > Mailing lists > Public > www-style@w3.org > October 2000

RE: New version of the Selectors module of CSS3

From: Ian Hickson <ianh@netscape.com>
Date: Fri, 6 Oct 2000 16:15:27 -0700 (Pacific Daylight Time)
To: Ian Brockbank <i.brockbank@indigovision.com>
cc: "'www-style@w3.org'" <www-style@w3.org>, Bert Bos <Bert.Bos@sophia.inria.fr>
Message-ID: <Pine.WNT.4.21.0010061607540.872-100000@HIXIE.netscape.com>
On Fri, 6 Oct 2000, Ian Brockbank wrote:
>>>
>>> STRUCTURAL PSEUDO-CLASSES
>>>
>>> I propose the following list of pseudo-classes. They are largely based on
>>> the :nth-child and related pseudos in the current draft, but have been
>>> made more useful, more generic, and more consistent with each other.
> [ snip ]
> 
> This seems a great idea.  There just seems to be one thing lacking
> (maybe I'm missing something).
> 
> How would one format alternating blocks of n elements with this scheme?
> (Using either syntax)  I can see a desire to do something like
> 
> TR:child(1,6,3) /* address first three of six */
> TR:child(2,6,3) /* address second three of six */
> 
> to have alternating bands of equal size.  (I'll leave you to improve
> the syntax; this was just an omission which jumped out at me).

Actually, the draft can do this, although not very neatly -- just style
the first three and then the fourth to the sixth:

   TR:child(1,6), TR:child(2,6), TR:child(3,6) /* address first three of six */
   TR:child(4,6), TR:child(5,6), TR:child(6,6) /* address first three of six */

This is not as bad as it looks, because the number is always finite.



(This kind of technique is currently used to do odd/even colouring:

   a:first-child
   a:first-child + a
   a:first-child + a + a 
   a:first-child + a + a + a
   a:first-child + a + a + a + a

...etc, grouping every other row, but in this case the set is infinite.

Here is an edge cae: wanting to group the first 100, then the second 100,
then the third 100... but then unless you have thousands and thousands,
you can use the grouping technique (with the only problem being that the
set is, once again, infinite).

   :children(1,100)
   :children(101,200)

...etc.

To be honest, if you are styling blocks of data with that many rows, you
should probably just transform it using XSLT into more managable chunks.
e.g., wrap tbodys around every hundred rows, and then style (in CSS)
selecting on the tbodys.)

-- 
Ian Hickson                                     )\     _. - ._.)       fL
Netscape, Standards Compliance QA              /. `- '  (  `--'
+1 650 937 6593                                `- , ) -  > ) \
irc.mozilla.org:Hixie _________________________  (.' \) (.' -' __________
Received on Friday, 6 October 2000 19:17:00 GMT

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