Main Index |
Top Of Tree |
Tag Index |
Tag History
- What is it?
- The CAPTION tag is an optional table element which displays
a caption/title for the table either directly above or below the
table. The CAPTION element is contained within the
TABLE tag, but is used at the same
level as the table row tag [TR] is.
- Attributes
- Align
- 2
| 3 | 3.2
| IE2 | M2A8
| N1.1
- Required? No
- Description:
The Align attribute specifies the alignment of the caption relative to
the table. Internet Explorer also defines extra Align values for
horizontal alignment within the Caption.
- Values:
Top, Bottom
- regular attributes
Left, Center
and Right - extra Internet Explorer 2.0
values for horizontal alignment of data within the table caption.)
- VAlign
- 2
| 3 | 3.2
| IE2 | M
| N
- Required? No
- Description:
This is an Internet Explorer attribute which takes the place of vertical
caption positioning relative to the table.
- Values:
Top | Bottom
Style Sheet Attributes
[More on Cascading Style Sheets]
- Class
- 2 | 3
| 3.2 | IE3B1
| M | N4B2
- Required? No
- Description:
This represents an assigned semantic classification grouping(s) for the
current tag.
- Values:
Given as a comma separated list of alphanumeric characters. Class names
may contain spaces (multiple consecutive spaces treated as a single
space.)
- ID
- 2 | 3
| 3.2 | IE3B1
| M | N4B2
- Required? No
- Description:
This assigns an alpha-numeric identifier that is unique
to this tag instance. Style sheets may use this attribute to reference
the current instance of this tag. Hyperlinks may also use this identifier
to serve as a destination.
- Values:
An alphanumeric string - initial character must be a letter followed
by alphabetic characters, digits, "-" or "."
characters. The allowable set of alpha-characters is restricted to the
A-Z and a-z set.
- Style
- 2 | 3
| 3.2 | IE3B1
| M | N4B3
- Required? No
- Description:
This attribute is a text string that provides rendering style
information for the current tag.
- Values:
Please see the description of
inline styles for more
information on how to use this attribute and its
possible values.
- Example
[Using the Simple Table Model]
- <table BORDER="2"
ALIGN="left" CELLPADDING="5"
BORDERCOLOR="#ff0000"
WIDTH="75%">
<caption ALIGN="top">Juggling Capabilities of Waterfront Performers</caption>
<tr> <th>Juggler</th><th>Pins</th><th>Bowling
Balls</th><th>Flaming Baseballs</th>
</tr>
<tr>
<td>Bob</td> <td>5</td> <td>2</td> <td>5</td>
</tr>
<tr>
<td>Larry</td> <td>2</td> <td>7!!!</td> <td>NA</td>
</tr>
<tr>
<td>Julie the Great</td> <td>1</td> <td>2</td> <td>20<br>(She IS great!)</td>
</tr>
<tr> <th COLSPAN=4>NOTE: This is only a small sample</th> </tr>
</table>
- Parent Model
- <table>
- Content Model
- %Text% |
%Anchors% |
%Virtual Formatting% |
%Physical Formatting% |
%Line Break Content% |
%Multimedia Content%
Tips & Tricks
- The Table model in HTML (even the Simple Table Model) is easily
the most complex markup structure in HTML. If you have general
questions about this structure see the Table
Overview.
- Compatibility Tip: To enable Table caption contents to display well
on browsers that do not support tables, it is common practice to put
either an extra space at the end of each table cell, or even better,
put a <br> tag at the end of each
table cell or caption. This should cause no display problems for
browsers that support tables (as there is an implied line break anyway
at the end of every table cell) and should greatly improve readability
on older browsers. (notice that I have not used this tip in these
pages yet because of time constraints. I hope to do this at some point
in the future.)
Browser Peculiarities
- Internet Explorer changed the intent of the ALIGN attribute in
their 2.0 release. They made the ALIGN attribute indicate
horizontal alignment of text within the caption (like the ALIGN
attribute in TH and TD) rather than the intended use by W3 to
indicate alignment of CAPTION data position relative to the
table. The relative-to-table attribute assigned to this duty
was a new VALIGN tag. The new reference for the 3.0 version of
Internet Explorer does not list the VALIGN attribute anymore
and it would appear that it only supports the W3 model, but
testing indicates that IE3 still supports the older
VALIGN attribute as well.
- The W3 Table model lists two additional attributes to ALIGN:
Right and Left to allow Captions to be placed to
the right or left side of a table. None of the popular browsers
seem to support this yet.
- The Tables specification says the CAPTION element should always
come at the beginning of a table structure (this is to ensure proper
rendering in progressive table display.) I have yet to see a
browser misbehave if the CAPTION is placed say, just before the end
of a table structure. It seems that as long as CAPTION is used at
the same level as a table row hierarchy element, things will
render fine.)
Boring Copyright Stuff...