Advanced Table Tags

While it is easy to build a simple table quickly with the tags we have described, you may desire more advanced table control such as varying border styles, running headers and footers, and column-based layout. HTML 4.0 adds new tags to accomplish these tasks, which originally appeared as extensions for Internet Explorer 3.0. Although they are defined in the latest standard, the latest browsers do not fully implement them. When making a table with these tags, make sure to test your tables on multiple browsers to ensure desired layout.

Table Section Tags

The three table section tags provide a way for you to break your table into logical sections: the header, body, and footer. You define the sections by placing the row tags (<tr>) within the <thead>, <tbody>, or <tfoot> tags. The usual attributes for controlling the placement of the contents can be used in these tags to set the alignment for the rows and cells they contain.

The main purpose for defining these sections is that when the table is printed or displayed in multiple sections, it will use consistent running headers and footers. Another benefit is that you can visibly delineate the sections by adjusting the size of the rules between them. Internet Explorer allows you to do this by supplying the rules attribute to the <table> tag with the values groups, rows, or all.

Column Grouping

Similar to the sectioning of tables by rows, you can also section tables by columns. You can define column groups ...

Get Webmaster in a Nutshell, Third Edition 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.