如何创建嵌套的四列表布局?
我正在尝试创建一个嵌套的4列表布局,请参见下图。但是,我不确定如何添加最后一行数据,因此它嵌套在日期行下面。我已经提供了来自a
代码段:
<table>
<thead>
<tr colspan="5">
<th>Regian</th>
<th>Q1 2010</th>
<th>Q2 2010</th>
<th>Q3 2010</th>
<th>Q4 2010</th>
</tr>
</thead>
<tbody className="labels">
<tr>
<td colSpan="5">
<label htmlFor="accounting">Accounting</label>
<input
type="checkbox"
name="accounting"
id="accounting"
data-toggle="toggle"
></input>
</td>
</tr>
</tbody>
<tbody className="hide" id="accounting-data">
<tr>
<td>Date</td>
<td>Australia</td>
<td>$3,544.00</td>
<td>$5,834.00</td>
<td>$10,583.00</td>
<tr>
<td>Central America</td>
<td>$7,685.00</td>
<td>$3,544.00</td>
<td>$5,834.00</td>
<td>$10,583.00</td>
</tr>
</tr>
</tbody>
</table>
I am attempting to create a nested 4 column table layout, see image below. However, I am not certain, how to add the last row of data, so it is nested under the Date row. I have provided a snippet from a codepen, which displays the issue. Can anyone provide any assistance?
Code Snippet:
<table>
<thead>
<tr colspan="5">
<th>Regian</th>
<th>Q1 2010</th>
<th>Q2 2010</th>
<th>Q3 2010</th>
<th>Q4 2010</th>
</tr>
</thead>
<tbody className="labels">
<tr>
<td colSpan="5">
<label htmlFor="accounting">Accounting</label>
<input
type="checkbox"
name="accounting"
id="accounting"
data-toggle="toggle"
></input>
</td>
</tr>
</tbody>
<tbody className="hide" id="accounting-data">
<tr>
<td>Date</td>
<td>Australia</td>
<td>$3,544.00</td>
<td>$5,834.00</td>
<td>$10,583.00</td>
<tr>
<td>Central America</td>
<td>$7,685.00</td>
<td>$3,544.00</td>
<td>$5,834.00</td>
<td>$10,583.00</td>
</tr>
</tr>
</tbody>
</table>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经有几个语法错误了,除此之外,仅在单元格上缺少
rowspan
,而HTML中的列比示例显示的更多。请参阅下面的更新示例。还不确定所有独立的tbody
标签是否有某种目的,但将它们留在那里,因为从技术上讲,它仍然有效地标记。干杯。You've got several syntax errors in there, beyond that just missing a
rowspan
on a cell and you had more columns in your html than your example shows. See updated example below. Also not sure if all the separatetbody
tags serve some sort of purpose but left them in there for ya since technically it's still valid markup. Cheers.