Up to this point all of the cells have been using the color set in the <TABLE> tag, but each cell can have it's own color by setting a color in the <TD> tag. All cells will use the color set in the <TABLE> tag unless You specify a different color. |
| Example 7: |
|
|
Code for Example 7:
|
<TABLE BORDER="1" BGCOLOR="#CCCCFF">
<TR>
<TD>One</TD>
<TD bgcolor="#FFCCCC">Two</TD>
</TR>
<TR>
<TD bgcolor="#FFFFCC">Three</TD>
<TD>Four</TD>
</TR>
</TABLE>
|
Notice the <TD> tags for cells "Two" and "Three" have different colors set. |
|
Each cell can have a color of it's own, but this would be seldom needed. Take a look at the Hexadecimal Color Chart it only contains 216 colors so a table with all 16.7 million colors would be a huge table. |
| Example 8: |
| One |
Two |
Three |
Four |
| Five |
Six |
Seven |
Eight |
|
|
Code for Example 8:
|
<TABLE BORDER="1" BGCOLOR="#CCCCFF">
<TR>
<TD bgcolor="#FFFFCC">One</TD>
<TD bgcolor="#FFCCFF">Two</TD>
<TD bgcolor="#FFCCCC">Three</TD>
<TD bgcolor="#CCFFFF">Four</TD>
</TR>
<TR>
<TD bgcolor="#CCFFCC">Five</TD>
<TD bgcolor="#CCCCCC">Six</TD>
<TD bgcolor="#FFFFFF">Seven</TD>
<TD>Eight</TD>
</TR>
</TABLE>
|
Notice that cell Eight uses the table's default color (#CCCCFF) |
|
In Example 9 You can see that the table's border can also be set to use any color, but setting the BORDERCOLOR will result in a loss of the border's 3D effect. |
| Example 9: |
| Red Border
|
Default Border
|
|
Code for Example 9: (Red border) |
<TABLE BORDER="5" BORDERCOLOR="#FF0000" BGCOLOR="#CCCCFF">
<TR>
<TD>One</TD>
<TD bgcolor="#FFCCCC">Two</TD>
</TR>
<TR>
<TD bgcolor="#FFFFCC">Three</TD>
<TD>Four</TD>
</TR>
</TABLE>
|
Notice that the border of each cell is also controlled by BORDERCOLOR. |
|