Is there a way to select one whole column in a table to style differently?
Is there a way to select one whole column in a table to style differently? without adding class or id to all those td?
I want to do with HT开发者_Python百科ML and css 2.1 only. with cross browser compatibility
You could try to use <col>
element.
You can select a column in a table by using jQuery cell selector plugin. Here is the example:
$('#mytable tbody td:nth-col(4)');
This code shows how to select the fourth column of a table.
HTH
I think recent versions of Safari, Opera and Firefox support the :nth-child
CSS selector, so that’s another option.
I don’t think IE 6 and 7 will give you any joy though, you’re stuck with adding classes to the <td>
s there.
精彩评论