Can a table row not contain cells?

I use HTML tables to create a schedule. Each row represents half an hour, and cells can span multiple rows using rowspan.

Sometimes I have empty elements tr, because all slots are taken by cells from the previous lines.

In this case, the HTML validator complains:

The row [N] of a row group created by an element tbodyhas no cells starting from it.

Of course, I could remove these empty ones trand decrease the value rowspanfor the expanded cells. But then the value rowspanwill no longer unambiguously correspond to the cell duration.

Consequently, are empty trreally invalid? Why?

+4
source share
2 answers

You cannot have empty rows in a table in a valid HTML document in the current HTML specification.

You may justly be able to, but the spec now clearly says that you cannot. Therefore, if someone believes that this should be allowed by the specification, the right thing is to submit a message about the problem with the HTML standard in your github-tracker or even write a patch and open PR for it .

In particular, the specification defines the following error case:

https://html.spec.whatwg.org/multipage/tables.html#the-table-element

, , , .

- "" , - . .

:

tr:

https://html.spec.whatwg.org/multipage/tables.html#the-tr-element td, th script -

" ", . , - " " ( ), tr .

.

+3

HTML :

tr, , , .

, .

<th> , . , , - , .

0

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


All Articles