Is it necessary to have in every table?

后端 未结 5 1305
离开以前
离开以前 2021-01-01 08:45

Is it necessary to have in every table? According to Standards.

5条回答
  •  忘掉有多难
    2021-01-01 09:34

    Dumb Guy gave an answer for HTML4 (yes). Arwym gives an answer for HTML5 to a related question (no):

    The tabular data spec for HTML5 does not require them:

    Contexts in which this element (tr) can be used:

    • As a child of a thead element.
    • As a child of a tbody element.
    • As a child of a tfoot element.
    • As a child of a table element, after any caption, colgroup, and thead elements, but only if there are no tbody elements that are children of the table element.

    Even though I believe it is a good practice to section your rows within thead, tbody and tfoot tags as it makes the table's rows easier to identify.

    In the end, the browser will always add at least the tbody for you.

提交回复
热议问题