Working with Rows and Columns

Using CSS, you can assign different colors and backgrounds to highlight row groups and column groups within your table. This not only makes your table more visually appealing, but it also helps to make your table more readable, by more clearly highlighting its different areas.

Setting Colors and Backgrounds for Row Groups

By assigning colors and backgrounds for the THEAD, TABLE, and TFOOT elements, you can distinguish your table's header, body, and footer sections by formatting them using different color schemes. For instance, here's an example of setting different colors for these three areas of the table (see Figure 12.11:

 table { border-collapse: collapse; border: 1px solid black; border-spacing: 0; width: 90%; ...

Get Cascading Style Sheets (CSS) by Example now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.