I have the following HTML table. I need to give a background color to each column (first column = red, second column = yellow, third column = blue). How can I do this using CSS?
Note: This need to work in IE6 onwards.
http://jsfiddle.net/Lijo/kw4yU/
<table id = "myTable">
<thead>
<tr>
<th>
Name
</th>
<th>
Address
</th>
<th>
Age
</th>
</tr>
</thead>
<tr>
<td>
Lijo
</td>
<td>
India
</td>
<td>
27
</td>
</tr>
</table>
EDIT:
I got it working by putting the js code inside document.ready. Thanks to @Jose Rui Santos http://jsfiddle.net/Lijo/kw4yU/11/
Another solution is http://jsfiddle.net/Lijo/kw4yU/12/
Yet another approach: Column width setting - HTML table