<caption> ... <caption>
Available in versions: 3.2, 4.0
The <caption> tag allows you to place a comment (caption) with a table.
The caption does not appear inside the table, but rather it appear outside the table on
either the top (default) or bottom.
Some browsers recognize proprietary attributes that permit placing the caption
on the left or right side of the table.
The caption tag must occur immediately after the table tag.
You can only have one caption per table.
The text that composes the caption can contain HTML tags and style sheet properties.
Note that the table tag has the summary attribute which is used with non-visual media
such as braille and speech to provide information about a table.
The closing tag is mandatory.
Core Attributes
class
dir
id
lang
onclick
ondblclick
onkeydown
onkeypress
onkeyup
onmousedown
onmousemove
onmouseout
onmouseover
onmouseup
style
title
Attributes
align deprecated 4.0
The align attribute allows you to specify if the caption is to appear on the top or
bottom of the table.
The default is top.
This attribute is deprecated effective with version 4.0.
However, most browsers continue to recognize this attribute.
You are now to use style sheets.
This example demonstrates the basic table tags:
Code:
<table width="80%" border="10" cellpadding="3" cellspacing="5" align="center">
<caption>
<center><b>How To Code A Table</b></center>
<br>
Use the caption tag to name the table and to provide useful information about the contents
</caption>
<tr>
<th colspan'"2">Use the <b>th</b> tag to create the header which will display in bold</th>
</tr>
<tr>
<td width="50%">The <b>tr</b> tag creates the row</td>
<td width="50%">The <b>td</b> tag creates individual cells for each row</td>
</tr>
<tr>
<td width="50%">You should always use the closing tags</td>
<td width="50%">You can use a variety of HTML tags inside the cell</td>
</tr>
<tr>
<td width="50%">The three new version 4.0 table tags are <b>tbody, tfoot,</b> and <b>thead</b></td>
<td width="50%">The <b>colspan</b> attribute allows you span more than one cell</td>
</tr>
</table>
Output:
How To Code A Table
Use the caption tag to name the table and to provide useful information about the contents
Use the th tag to create the header which will display in bold |
The tr tag creates the row |
The td tag creates individual cells for each row |
You should always use the closing tags |
You can use a variety of HTML tags inside the cell |
The three new version 4.0 table tags are tbody, tfoot, and thead |
Setting colspan allows you span more than one cell |
Copyright 2000 by Infinite Software
Solutions, Inc.
Trademark Information
|