csscss-tables

Targeting specific column in table


I have a table of class players with 5 columns and 40 rows. I want to make the second column have width: 200px.

I can not figure out how to select the specific column in the table. So far I have narrowed it down to this, but this does it to all of the rows in the table. How can I set the column width for a specific column?

table.players td 
{
    
}

Solution

  • This should work (except on IE8 and below):

    table.players td:nth-child(2) { width: 200px; }