Table Background Color and Image
How to set background color for table?
Setting background image for table?
Explanation
Table with color
We can add background color to the table using the attribute "bgcolor".
This attribute can be added in "table"/"tr"/"td" tag. The color can be set on the whole to table or to rows and column
Example : <table border=1 bgcolor="green">
<tr>
<td>
This is first column
</td>
<td bgcolor="yellow">
This is second column
</td>
</tr>
</table>
Result : The result for above tag will be as
This is first column | This is second column |
Table with background image
Now we will try to create a table with one column having a background image
Example : <table border=1 bgcolor=green>
<tr>
<td>
This is 1st row 1st column
</td>
<td>
This is 1st row 2nd column
</td>
</tr>
<tr>
<td>
This is 2nd row 1st column
</td>
<td background="./test.jpg">
This is 2nd row 2nd column <br><br> Nice background
</td>
</tr>
</table>
Result : The result for above tag will be as
This is 1st row 1st column | This is 1st row 2nd column |
This is 2nd row 1st column | This is 2nd row 2nd column Nice background |