Setting Background Colors


All parts of a table have a background. The initial value of background is transparent, but all elements cells, rows, row groups, columns, column groups, and of course the table itself can be given a color and a background image. Here is an example in which a row, a column, and a cell have been given a background color:

 <TABLE>   <COL ><COL >     <COL ><COL >   <TR ><TD>aa <TD>ab <TD>ac <TD>ad   <TR ><TD>ba <TD>bb <TD>bc <TD>bd   <TR ><TD >ca <TD>cb <TD>cc <TD>cd   <TR ><TD>da <TD>db <TD>dc <TD>dd </TABLE> 

with the style sheet:

 TABLE {background: green; border-collapse: collapse} COL.c {background: rgb(191,191,191)} TR.c {background: rgb(255,170,0)} #c1 {background: black; color: white} TD {padding: 0.25em} 

As Figure 17.8 shows, the background of the table is hidden by the column background, which in turn is hidden by the row. The cell is on top of everything.

Figure 17.8. Overlapping backgrounds.


Column groups (COLGROUP) and row groups (THEAD, TFOOT, and TBODY) can also be given backgrounds. Column groups are in front of the table background, but behind the columns, row groups are in front of columns and behind rows.



Cascading Style Sheets(c) Designing for the Web
Cascading Style Sheets: Designing for the Web (3rd Edition)
ISBN: 0321193121
EAN: 2147483647
Year: 2003
Pages: 215

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net