thead, tfoot and tbody order in HTML5

后端 未结 3 1414
旧时难觅i
旧时难觅i 2021-01-05 00:04

I was reading in a forum about element that it must come after element. In contrast I saw some people use the order

相关标签:
3条回答
  • 2021-01-05 00:53

    According to the W3 specs, tfoot has to come before tbody. (Links to specs here -> Why do internal TABLE sections have to go THEAD TFOOT TBODY to validate?)

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

    0 讨论(0)
  • 2021-01-05 00:53

    In the HTML 5.1 spec, <tfoot> can only come after <tbody>.

    In this order: optionally a caption element, followed by zero or more colgroup elements, followed optionally by a thead element, followed by either zero or more tbody elements or one or more tr elements, followed optionally by a tfoot element, optionally intermixed with one or more script-supporting elements.

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

    0 讨论(0)
  • 2021-01-05 01:01

    Before HTML5, <tfoot> had to come after <thead> and before <tbody>. With HTML5, <tfoot> can come before <tbody> or after it. But there must be only one <tfoot> child of a <table> element, and it must be after <thead>.

    0 讨论(0)
提交回复
热议问题