XHTML 5 Reference

go to previous section go to next section


Tables care used to define tabular data. To determine whether you really have tabular data and therefore should be using a table you should consider whether the content will make sense with borders applied around all of the cells, if it doesn't then it probably isn't tabular data. Note that there is at least one browser that automatically applies a one pixel black border around all table cells as the default. XHTML 5 has not made any changes to the tags available to define tables, the only difference from when XHTML 1.0 was released is that browsers now all support CSS and so misusing tables for layout is no longer necessary (in fact CSS has display options for applying table layouts to the page if you require a table type layout that still allows you to use the semantically appropriate tags).

The following tags are used to define tables.

The summary attribute can optionally be used to describe the purpose of the table.

Optional Tags

The following tags can optionally be provided at the top of the table:

Parts of a Table

The following tags define the parts of a table:

Defining Rows

Within each part of the table the actual data itself is broken up into rows defined using <tr> </tr>.

The individual cells in each row are defined using <td> </td> for data cells and <th> </th> for heading cells.

The following attributes can optionally be applied to td and th tags:

Heading cells can also have a scope="row" or scope="col" attribute applied to indicate whether it is a row or column heading.

While there are a number of other attributes that can be applied to the various table tags, there are no other attributes that need to be used as all of the other attributes simply duplicate what can be done using CSS.

go to previous section go to next section


This article written by Stephen Chapman, Felgall Pty Ltd.

go to top

FaceBook Follow
Twitter Follow