Basic Table Tags
You can create a wide variety of tables 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 you place
them within the browser window by stylesheet, 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.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access