Can HTML table have variable number of cells on rows?

后端 未结 5 763
情歌与酒
情歌与酒 2020-12-10 11:34

Or should the total amount of cells equal to columns * rows?

A table with different amount of cells on different rows seems to pass the W3 Validator.

5条回答
  •  伪装坚强ぢ
    2020-12-10 12:13

    Yes, it can. In table > tr > td, td is contain the content. Td reference here: http://www.htmlcodetutorial.com/tables/_TD.html. In that reference, you can see that TD has 2 attributes that is: colspan and rowspan. By using those 2 attributes, a table can have different amount of cells on different rows.
    Demo:

    a b
    c

    And

    a b
    c

提交回复
热议问题