webmaster resources tips and articles
webmaster information

Path = Home : HTML Design Tips : How To Add Background Colors To Tables

How To Add Background Colors To Tables

 

The <table> tag is the HTML tag used to create a table on a web page.

To add background color to a table you use bgcolor="#color value " where #color value is the hex value for the color you want.

The same background color for all the table

<table width="460" border="1" cellpadding="5" cellspacing="0" bgcolor="#00CCFF">
<tr>
<td>Column 1 </td>
</tr>
</table>

Column 1

 

The same background color for each column in the table

<table width="460" border="1" cellpadding="5" cellspacing="0" bgcolor="#00CCFF">
<tr>
<td>Column 1 </td>
<td>Column 2</td>
</tr>
</table>

Column 1 Column 2

 

Different background colors for each column in the table

<table width="460" border="1" cellspacing="0" cellpadding="5">
<tr>
<td bgcolor="#00CCFF">Column 1</td>
<td bgcolor="#CC9933">Column 2</td>
</tr>
</table>

Column 1 Column 2

 

Different background colors for each column and row in the table

<table width="460" border="1" cellspacing="0" cellpadding="5">
<tr>
<td bgcolor="#00CCFF">Column 1 Row 1</td>
<td bgcolor="#CE9A31">Column 2 Row 1</td>
</tr>
<tr>
<td bgcolor="#99FF99">Column 1 Row 2</td>
<td bgcolor="#CC99FF">Column 2 Row 2</td>
</tr>
</table>

Column 1 Row 1 Column 2 Row 1
Column 1 Row 2 Column 2 Row 2

 

 

© janim.net 2000 - 2007 All rights reserved