Thead, tfoot and tbody in HTML5

I read in the forum about the <tfoot> element, which should appear after the <thead> element. In contrast, I saw some people use the <thead><tbody><tfoot> . So, what is the right and best order to follow?

+8
source share
4 answers

Before HTML5, <tfoot> was supposed to go after <thead> and before <tbody> . In HTML5, <tfoot> can go before or after <tbody> . But there should be only one <tfoot> of the <table> <tfoot> element, and it should be after the <thead> .

+22
source

According to W3 specs, tfoot should go through to tbody . (Links to technical specifications here โ†’ Why do TABLE internal tables need to pass TEAF TFOOT TBODY for verification? )

This was done in order to first load the header and footer of the table before loading into a variable amount of body data, which otherwise could block the loading of the footer of the table.

+3
source

In the HTML 5.1 specification, <tfoot> can only appear after <tbody> .

In this order: optionally a header element, followed by zero or more colgroup elements, followed by an optional aad element, followed by either zero or more tbody elements, or one or more tr elements, optionally followed by a tfoot element, optional mixed with one or more script support elements.

https://www.w3.org/TR/html51/tabular-data.html#tabular-data

+2
source

for me in one of my projects I tried to test some Datatables functions and it works! i think this will give you an idea of โ€‹โ€‹the order

0
source

Source: https://habr.com/ru/post/954194/


All Articles