Basic Table Tags
A wide variety of tables can be created with only five tags: the
<table>
tag, which encapsulates a table and
its elements in the document’s body content; the
<tr>
tag, which defines a table row; the
<th>
and <td>
tags,
which define the table’s headers and data cells; and
the <caption>
tag, which defines a title or
caption for the table. Beyond these core tags, you may also define
and control whole sections of tables, including adding running
headers and footers, with the <colgroup>
,
<col>
, <tbody>
,
<thead>
, and
<tfoot>
tags. Each tag has one or more
required and optional attributes, some of which affect not only the
tag itself but also related tags.
The <table> Tag
The
<table>
tag and its
</table>
end tag define and encapsulate a
table within the body of your document. Unless otherwise placed
within the browser window by style sheet, paragraph, division-level,
or other alignment options, the browser stops the current text flow,
breaks the line, inserts the table beginning on a new line, and then
restarts the text flow on a new line below the table.
Get HTML & XHTML: The Definitive Guide, 5th Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.