Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML

Table Tricks

Advanced Attributes of the Table Tags

By Jennifer Kyrnin, About.com

Tables are a great way to layout your Web pages, and HTML 4.0 offers a few more attributes and tags to this versatile and flexible tool. Some of these attributes work differently in Netscape than in Internet Explorer, so always be sure to view the page in both browsers.

Attributes

cols
an attribute of thetabletag
If you have a large table to display on the screen, you can help speed up the download time by telling the browser how many columns are in the table.

Note: this can make tables look strange, as the browsers are not always consistent in how they use this attribute.

Tags

<caption> .. </caption>
Use the caption tag to place explanatory text about a table near the table.

Note: Netscape and Internet Explorer position the caption in different places, so be sure to view your pages with both browsers

<thead> .. </thead>
This tag defines the enclosed rows as the header rows of the table. If the table is broken across several physical pages (such as when printing), the header rows will be repeated. Internet Explorer only

<tfoot> .. </tfoot>
This tag defines the enclosed rows as the footer rows of the table. If the table is broken across several physical pages (such as when printing), the footer rows will be repeated. Internet Explorer only

<tbody> .. </tbody>
This tag divides your table into discrete sections. Each section is delimited with a rule line. Internet Explorer only

<colgroup> .. </colgroup>
This tag is used to group together columns in a table. It allows you to treat the columns in your table similarly to the rows, including rule lines to differentiate the columns. It goes at the beginning of the table, before the content. Internet Explorer only

<col> .. </col>
This tag is used to define the appearance of the columns within a colgroup. Internet Explorer only

Previous Features

Explore Web Design / HTML

About.com Special Features

Web Design / HTML

  1. Home
  2. Computing & Technology
  3. Web Design / HTML
  4. About.com Web Design A to Z
  5. Web Design Articles R-Z
  6. Web Design/HTML Articles T
  7. Table Tricks

©2009 About.com, a part of The New York Times Company.

All rights reserved.