Re: idea about pseudo-selectors

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

</Daniel>

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