In this page we'll look at two techniques for setting the background images of table cells. Which technique you use depends on which is more convenient to your situation.
In the first example, we'll assume that you want all the
<TH ...><TD ...><TH ...>deepsea class. (They also apply to any element of the deepseacell class; we'll get to that shortly.)
<STYLE TYPE="text/css">
<!--
.deepsea TH, .deepseacell
{
background-image:url('deepsea.gif');
background-color:blue;
color:white;
font-family:sans-serif;
font-weight:700;
}
-->
</STYLE>
Now we apply the rules to a table by setting the table to the
deepsea class. notice in the following code that we don't need to do anything special to the <TH ...>deepsea element,
<TABLE CELLPADDING=5CLASS="deepsea"> <TR><TH>Operator</TH> <TD>Starflower</TD> <TD>Melody</TD> </TR> <TR><TH>ExT </TH> <TD>8172</TD> <TD>5673</TD> </TR> <TR><TH>City</TH> <TD>San Francisco</TD> <TD>San Pedro</TD> </TR> </TABLE>
which gives us this table:
| Operator | Starflower | Melody |
|---|---|---|
| Ext | 8172 | 5673 |
| City | San Francisco | San Pedro |
Now suppose that you can't set the general rule that all
<TH ...>CLASS attribute. We'll set those cells to the
deepseacell class using the same style rules set above. notice that in this case wedon't have a
CLASS attribute in the <TABLE ...>
<TABLE CELLPADDING=5> <TR> <TD>turtles</TD> <TD CLASS="deepseacell">starflowers</TD> <TD>peaches</TD> </TR> <TR> <TD CLASS="deepseacell">cats</TD> <TD>patchouli</TD> <TD>grapefruit</TD> </TR> </TABLE>
which gives us
| turtles | starflowers | peaches |
| cats | patchouli | grapefruit |
<TABLE ...>