Можем ли мы иметь несколько < tbody > в том же < столе & gt ;?

569
задан Danield 15 August 2018 в 05:45
поделиться

3 ответа

Yes you can use them, for example I use them to more easily style groups of data, like this:

thead th { width: 100px; border-bottom: solid 1px #ddd; font-weight: bold; } tbody:nth-child(odd) { background: #f5f5f5; border: solid 1px #ddd; } tbody:nth-child(even) { background: #e5e5e5; border: solid 1px #ddd; }
CustomerOrderMonth
Customer 1#1January
Customer 1#2April
Customer 1#3March
Customer 2#1January
Customer 2#2April
Customer 2#3March
Customer 3#1January
Customer 3#2April
Customer 3#3March

You can view an example here. It'll only work in newer browsers, but that's what I'm supporting in my current application, you can use the grouping for JavaScript etc. The main thing is it's a convenient way to visually group the rows to make the data much more readable. There are other uses of course, but as far as applicable examples, this one is the most common one for me.

697
ответ дан 22 November 2019 в 22:07
поделиться

Согласно этому примеру это можно сделать: w3-struct-tables .

47
ответ дан 22 November 2019 в 22:07
поделиться

Да. Из DTD

<!ELEMENT table
     (caption?, (col*|colgroup*), thead?, tfoot?, (tbody+|tr+))>

Поэтому он ожидает один или несколько. Далее говорится

Используйте несколько разделов tbody, когда правила необходимы между группами таблиц строк.

297
ответ дан 22 November 2019 в 22:07
поделиться
Другие вопросы по тегам:

Похожие вопросы: