Word 2003 Tables Using CSS

No other HTML element has been as maligned or as abused as the table. And yet, tables do have a purpose - to show tabular data. In this article we demonstrate how cascading stylesheets can be effectively used to style HTML tables to look like the ones produced by Microsoft Word 2003. Using CSS styling for tables delivers a more consistent cross-browser look & feel and is more in keeping with good design principles.

All styling effects are delivered by the simple expedient of changing the className attribute of the HTML table element. The only other table attribute we use is cellspacing which is set to 0. All other styling effects are delivered using CSS along.

The full set of style sheets required to display the table styles available here can be downloaded from the link at the bottom of this page. Our style definitions are somewhat verbose - largely, for three reasons

For most practical purposes it should be possible to considerably simplify the individual styles. A document demonstrating the table styles as they appear in Word is available as part of the download along with the HTML code for the table itself.

The code here is an excellent demonstration of how grouping & nesting rules can be used to good effect to deliver extremely targeted document styling. When rules get this complex it is necessary to follow clear principles of nomenclature. The principles we have used are summarized below

The table below mimics the 3d1 style in Word 2003. To see other Word 2003 table styles simply click on the style name in the listbox.

  Jan Feb March Total
Total 21 18 21 60
East 7 7 5 19
West 6 4 7 17
North 8 7 9 24

Download
Jump To...

Colophon