This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 24425 - Add new indexing pseudo-class for cell in column
Summary: Add new indexing pseudo-class for cell in column
Status: NEW
Alias: None
Product: CSS
Classification: Unclassified
Component: Selectors (show other bugs)
Version: unspecified
Hardware: PC Windows NT
: P2 normal
Target Milestone: ---
Assignee: fantasai
QA Contact: public-css-bugzilla
Depends on:
Reported: 2014-01-28 14:59 UTC by Arkadiusz Michalski (Spirit)
Modified: 2014-01-28 16:38 UTC (History)
0 users

See Also:


Description Arkadiusz Michalski (Spirit) 2014-01-28 14:59:53 UTC
Now whe have define some indexing pseudo-class, and we can use it in different ways:

col:nth-child(2n+1) - take all odd column (what we defined in HTML) and use some style. So indexing is make for all child in table (but col and colgroup must be first, so theat, tfoot and tbody we can easy filter). With this selector we can style all cell in column (when property is inherit). Very similar result we get when use col:nth-of-type(2n+1) or :nth-match(2n+1 of col). 

td:nth-column(2n+1) - if I correctly understand this, we take all odd column, and select only cell which are td element. So indexing is make for column, but we select cell, it's strange (differently than in previous pseudos), but ok, in some case this can be usefull. 

From Selector4:
"The :nth-column(An+B) pseudo-class notation represents a cell element belonging to a column that has An+B-1 columns before it, for any positive integer or zero value of n."

"E:nth-column(n) - an E element that represents a cell belonging to the nth column in a grid/table "

But where is selector which indexing cell in column and select cell? Like this:
td:nth-cell(2n+1). It's mean, indexing all cell in single column (separately for any column), take only odd cell, and take only td.  

I know pseudos for column is sth news, but it is worth considering make some more useful selectors in this area.
Comment 1 Arkadiusz Michalski (Spirit) 2014-01-28 16:38:42 UTC
And one more thing for nth-column() and nth-last-column(). In HTML we can make group of columns (e.g. in table):

<colgroup span="2"></colgroup>	
	<col span="1">		
	<col span="4">	 

So, it's important how exactly indexing for column must be done - take all column (independently from their groups) or separated (each group have own index for column). But this behaviour should be determined in document language (like HTML5).