gpt4 book ai didi

html - 为什么 inner tbody 不拉伸(stretch)?

转载 作者:行者123 更新时间:2023-11-27 23:19:17 26 4
gpt4 key购买 nike

我对表格有疑问。这是我的代码:

<table class="employers__table">
<thead>
<tr>
<td>Таб. №</td>
<td>Сотрудник / СИЗ</td>
<td>Разм. ряд</td>
<td>Кол.</td>
<td>Ед. изм.</td>
<td>Дата выдачи</td>
<td>Дата замены</td>
<td>Списать СИЗ</td>
<td>Продлить СИЗ</td>
</tr>
</thead>
<tbody>
<tbody class="label">
<tr>
<td colspan="9">
Aaa
</td>
</tr>
</tbody>
</tbody>
</table>
.employers__table {
overflow-y: scroll;
}
.label tr > td {
background-color: #000;
color: #fff;
}

<tbody>不拉伸(stretch)。 This is how it looks .

为什么会这样?

我试图在新元素中创建一个具有相同结构的表,并且在那里工作......我不明白。

最佳答案

你基本上违背了 HTML TABLE 的基本语义.

它允许您拥有多个 <tbody>table 里面, 但未嵌套 tbody

<TABLE>
<THEAD>
<TR> ...header information...
</THEAD>
<TFOOT>
<TR> ...footer information...
</TFOOT>
<TBODY>
<TR> ...first row of block one data...
<TR> ...second row of block one data...
</TBODY>
<TBODY>
<TR> ...first row of block two data...
<TR> ...second row of block two data...
<TR> ...third row of block two data...
</TBODY>
</TABLE>

更正的代码段

.employers__table {
overflow-y: scroll;
}

.label tr>td {
background-color: #000;
color: #fff;
}
<table class="employers__table">
<thead>
<tr>
<td>Таб. №</td>
<td>Сотрудник / СИЗ</td>
<td>Разм. ряд</td>
<td>Кол.</td>
<td>Ед. изм.</td>
<td>Дата выдачи</td>
<td>Дата замены</td>
<td>Списать СИЗ</td>
<td>Продлить СИЗ</td>
</tr>
</thead>
<tbody class="label">
<tr>
<td colspan="9">
Aaa
</td>
</tr>
</tbody>
</table>

关于html - 为什么 inner tbody 不拉伸(stretch)?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58107977/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com