PDA

View Full Version : css style for table in class


indianleo
09-16-2009, 12:14 PM
Hello friends I have an textarea where we can insert a table, which will get render in div. SO i want to style in css file where any table inserted in container div should have one class apply



<div id="container">
<table class="color-table" width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
</table>

</div>

Corrosive
09-16-2009, 12:37 PM
#container td {} maybe?

indianleo
09-16-2009, 01:20 PM
but i want the td in first tr to have green background color rest all tr with white background color

Corrosive
09-16-2009, 02:10 PM
If it is a table header then you should be using the th tag. So style this as

#container th {}

http://www.w3schools.com/TAGS/tag_th.asp