G
G
global Error2015-10-07 06:12:31
HTML
global Error, 2015-10-07 06:12:31

Why is the order of table thead, tfoot, tbody tags in the semantic layout of html?

I am reading the book "Web Mastering 2013" by Klimenko R. A. It says that the order is this.
ps: "Note that the table footer is defined above the table content itself, i.e. thead tag comes first, then tfoot and only then tbody."

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
Cat Anton, 2015-10-07
@Mowsar

Within a table, TFOOT must come before TBODY so that the user's browser can display TFOOT before getting all the other rows from TBODY, which can be very many.

www.w3.org/TR/html401/struct/tables.html#h-11.2.3
Imagine you have a very large table:
<table>
    <thead>
        <tr>...</tr>
    </thead>
    <tfoot>
        <tr>...</tr>
    </tfoot>
    <tbody>
        <tr>...</tr>
        <!-- Ещё тысячи строк... -->
        <tr>...</tr>
    </tbody>
</table>

In this case, the browser will quickly display THEAD and TFOOT to the user (usually they do not contain many lines), and the user will wait until the rest of the lines from TBODY are loaded. If TFOOT came after TBODY, the user would have to wait until TBODY is fully displayed before seeing TFOOT.
In HTML5, this order is also allowed: thead, tbody, tfoot.

C
Cat Scientist, 2015-10-07
@eruditecat

Semantics is irrelevant here. First, the top and bottom headers of the table are loaded, and then, between them, its body.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question