We can use background colors for tables in new browsers. You can specify background color options inside <TABLE> tag.
Example:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
<BODY>
<TABLE width=”300″ BGCOLOR=”#66CCFF”>
<TR>
<TD width=”50%”>A</TD>
<TD width=”50%”>B</TD>
</TR>
<TR>
<TD width=”50%”>C</TD>
<TD width=”50%”>D</TD>
</TR>
</TABLE>
</BODY>
</HTML>
In above example entire table will change to new color even table borders. You can also determine background color for each row of your table. If you want to do this, you must use BGCOLOR option inside <TR> tag of the desired row. This second method will only change colors of cells in specified row.
Example:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
<BODY>
<TABLE width=”300″ BORDER=1>
<TR BGCOLOR=”#66CCFF”>
<TD width=”50%”>A</TD>
<TD width=”50%”>B</TD>
</TR>
<TR BGCOLOR=”#CCFFFF”>
<TD width=”50%”>C</TD>
<TD width=”50%”>D</TD>
</TR>
</TABLE>
</BODY>
</HTML>
You can even change color of individual cells by using BGCOLOR option in <TD> </TD> cell tags. You can mix all above options to create your desired table. In next example we will change color of first row to “#336699″. Then we will change color of two cells in second row to “#66CCFF” and “#CCFFFF” respectively.
Example:
<HTML>
<HEAD>
<TITLE>Example</TITLE>
</HEAD>
<BODY>
<TABLE width=”300″ BORDER=1>
<TR BGCOLOR=”#336699″>
<TD width=”50%”>A</TD>
<TD width=”50%”>B</TD>
</TR>
<TR>
<TD width=”50%” BGCOLOR=”#66CCFF”>C</TD>
<TD width=”50%” BGCOLOR=”#CCFFFF”>D</TD>
</TR>
</TABLE>
</BODY>
</HTML>
