W3C home > Mailing lists > Public > www-style@w3.org > August 2006

Re: idea about pseudo-selectors

From: Daniel Glazman <daniel.glazman@disruptive-innovations.com>
Date: Tue, 08 Aug 2006 12:24:57 +0200
Message-ID: <44D86679.2030802@disruptive-innovations.com>
To: Ming Teo <ming@staff.highway1.com.au>
Cc: www-style@w3.org

Ming Teo wrote:

> I had an idea for something like this... from what I see in the CSS3 
> working draft, there's |:nth-child| and :nth-child-of-type etc, but how 
> would one, say cover odds and evens?
> A lot of people, esp. in tabular data, want to have every second row 
> coloured a different way. The way we do it is assigning a class to every 
> second row. Or using javascript/some other scripting method to do it?
> What about an |:odd-child|, |:odd-child-of-type|, |:even-child|, and 
> |:even-child-of-type|?
> Wouldn't those be awesome pseudo-selectors?

Excerpt from section 6.6.5 of Selectors [1]:

    In addition to this, :nth-child() can take 'odd' and 'even' as
    arguments instead. 'odd' has the same signification as 2n+1, and
    'even' has the same signification as 2n.

[1] http://www.w3.org/TR/2005/WD-css3-selectors-20051215/#nth-child-pseudo

Received on Tuesday, 8 August 2006 10:25:05 UTC

This archive was generated by hypermail 2.3.1 : Monday, 2 May 2016 14:27:25 UTC