JavaScript EditorBest javascript editor debugger     Ajax website 

Main Page

Previous Page
Next Page

Dividing the Table into Horizontal Sections

You can also mark a horizontal section of your tableone or more rowsand then format it all at once. You'll also be able to draw dividing lines between sections, instead of between individual rows (see page 249).

Figure 16.55. Once the first row is in a thead section, I can define a class of styles for it which will be applied to each cell in the thead.

To divide the table into horizontal sections:

Before the first TR tag of the section you want to create, type <thead, <tbody, or <tfoot.

If desired, define the desired attributes for the section.

Type >.

If necessary, create the section's contents.

Close the section with </thead>, </tbody>, or </tfoot>

Figure 16.56. In the CSS, I'll give the thead element the same background as the left column and will center both the thead and the tbody.

Figure 16.57. All of the elements in the thead section are formatted and they will be considered a unit when the interior borders are drawn.


  • You can apply CSS (or indeed, formatting attributes) to horizontal sections of cells.

  • Horizontal section tags go after column group tags (see page 246).

  • At least one tbody tag is required in every table. Both XHTML, as long as it is served as an HTML file (e.g., with the .html extension) and HTML will create an implicit tbody if you omit it. XHTML served as XML (with the .xml extension) requires an explicit tbody element.

  • You can only have one thead and one tfoot per table.

  • In HTML, but not XHTML, the closing tags are optional. A section is automatically closed when you begin the next.

Previous Page
Next Page

JavaScript EditorBest javascript editor debugger     Ajax website