Search code examples
htmlfooter

HTML table footer is coming before the header


I am just trying to make a simple table in HTML, I understand that the tfoot element should be rendered before the body, so you place it between the body and the thead element. I've tried placing it before and after the body, but I still get the table below.

This is the footer of the table

A table

List Type Tags

Ordered List <ol>, <li>

Unordered List <ul>, <li>

Term and Definition list <dl>, <dt>, <dd>

<head></head>
<body>
<table>
<caption>A table</caption>
<thead>
<tr>
<th>List Type</th>
<th>Tags</th>
</tr>
</thead>
<tbody><tr><td>Ordered List</td><td>&lt;ol&gt;, &lt;li&gt;</td></tr><tr><td>Unordered List</td><td>&lt;ul&gt;, &lt;li&gt;</td></tr>
 <tr><td>Term and Definition list</td><td>&lt;dl&gt;, &lt;dt&gt;, &lt;dd&gt;</td>    </tr>
 <tfoot>
 This is the footer of the table
 </tfoot>
</tbody>
</table>
</body>

What gives?


Solution

  • you're not supposed to put content right after <tfoot> you need to add <tr> and <td>