HTML Table, thead, tbody, tfoot

By Xah Lee. Date: . Last updated: .

This page shows examples HTML table example with {caption, thead, tbody, tfoot} tags.

Table with Caption

Use caption for table's caption.

table example
1,1 1,2 1,3
2,1 2,2 2,3

Here's the source code:

<table border="1">
<caption>table example</caption>
<tr>
<td>1,1</td>
<td>1,2</td>
<td>1,3</td>
</tr>

<tr>
<td>2,1</td>
<td>2,2</td>
<td>2,3</td>
</tr>
</table>

Table with {thead, tbody, tfoot, th} Tags

The {thead, tbody, tfoot} do not have any default rendering. (use CSS for that)

When using thead or tfoot, you can use th instead of td, which will make it bold.

cats dogs
7 6
Cats win!

Here's the source code:

<table border="1">
<thead>
<tr>
<th>cats</th>
<th>dogs</th>
</tr>
</thead>

<tbody>
<tr>
<td>7</td>
<td>6</td>
</tr>
</tbody>

<tfoot>
<tr>
<th colspan="2">Cats win!</th>
</tr>
</tfoot>

</table>

HTML Basics

  1. HTML Basics
  2. HTML5 Tags
  3. Case Sensitivity
  4. Allowed Characters
  5. Charset and Encoding
  6. Self-Closing Tags
  7. Multiple Class Value
  8. HTML Entity List

HTML Table

  1. HTML Table Examples
  2. HTML Table, thead, tbody, tfoot
  3. HTML Table, colgroup, col
  4. Styling HTML Table with CSS
  5. CSS: 3 Columns Page Layout
  6. Pure CSS Table

Misc

  1. Viewport Meta
  2. the Root Element
  3. iframe
  4. video
  5. audio
  6. figure
  7. dl, dt, dd
  8. s strike del
  9. time
  10. meter
  11. progress
  12. q
  13. address
  14. canvas
  15. ruby
  16. HTML5 Custom Data Attribute
  17. Big Tag
  18. Image Maps
  19. Marquee, Scrolling Text
  20. How to Markup Subtitle
  21. Meta Language Tag Obsolete
  22. Browser Auto Refresh

HTML4 Frameset

  1. HTML: Split Windows; Frameset
  2. HTML Nested Frameset
Like it? Help me by telling your friends. Or, Put $5 at patreon.

Or, Buy JavaScript in Depth

If you have a question, put $5 at patreon and message me.

Web Dev Tutorials