Forum Moderators: not2easy
Just a couple of quick questions here! Are there any CSS rules that I could use to allow me to format specific elements of a table, without actually altering the HTML of every cell I want to change?
For example, I have a 3-column, 50-row table.
Could I attach a rule in the main table tag to allow me to have no cell padding in column 2, but still have cell padding on columns 1 and 3?
Could I attach a rule in the main table tag to change the colour of every other row in this table, so I get odd numbered rows with a white background and even numbered rows with a coloured background?
Thanks very much
:-)
<table style="font-size: 12px; width: 100%;" summary="Your table summary here.">
<colgroup style="width: 50%;"></colgroup>
<colgroup style="width: 50%;"></colgroup>
<tr><td></td></tr>
<tr><td></td></tr>
</table>
As for alternating colors of alternating rows that is only supported in CSS3 and so where you see it effectively implemented online right now (2007) is due to serverside manipulation.
Here is the CSS3 Spec [w3.org].
- John
The CSS3 code