Learning HTML 3.2 by Examples, section 5 Descriptions of HTML 3.2 tags:

CAPTION - caption for a table (Not in HTML 2.0!)

Purpose

To present a caption (title) for a table.

Typical rendering

Above or under the table itself, often but not necessarily using some special, more prominent font.

Usually the caption is horizontally centered. (HTML 3.2 provides no tool for changing the browser behavior in this respect.)

Basic syntax

<CAPTION>text</CAPTION>

Possible attributes

attribute name possible values meaning notes
ALIGN TOP, BOTTOM placement of the caption relative to the table usually the default is TOP

The use of this attribute is deprecated in HTML 4.0.

Allowed context

TABLE element. If present, the CAPTION element must appear first, before the TR elements.

Contents

Text elements.

Examples

<CAPTION>Summary of measurement results</CAPTION>
<CAPTION><EM>Mean temperatures</EM></CAPTION>

Notes

You should normally include a caption for each table. The caption text should be relatively short, yet informative. Avoid inserting explanations into a caption. Give the explanations within normal text paragraphs. A caption should tell what the table is about. The normal text (outside the table) should tell why the table is presented, i.e. how the table relates to the text of the document.

See the discussion of tables, which contains additional examples, too.

Some browsers (e.g. Netscape) do not render the caption in a visually distinctive manner. Using phrase markup such as EM or STRONG within the CAPTION element may therefore be desirable.



Date of last update: 2010-12-16.
This page belongs to the free information site IT and communication, section Web authoring and surfing, by Jukka "Yucca" Korpela.