【发布时间】:2018-06-16 14:38:58
【问题描述】:
我正在处理一个顶部有多个列标题的输入表单。在每个日期标题(下面的 codepen)下,需要有四列。我似乎可以做到这一点的唯一方法是不使用<tbody>,而只在<thead> 空间中播放。
我的问题是这是否是正确的方法。如果我在<tbody> 中添加列,它只会将所有行向左对齐,而不是跨表对齐。
这是Codepen。
<table class="table table-bordered table-dark">
<thead>
<tr>
<th scope="col" class="text-center name">Students</th>
<th colspan="4" scope="col" class="text-center"><input class="form-control" type="date"></th>
<th colspan="4" scope="col" class="text-center"><input class="form-control" type="date"></th>
<th colspan="4" scope="col" class="text-center"><input class="form-control" type="date"></th>
<th colspan="4" scope="col" class="text-center"><input class="form-control" type="date"></th>
</tr>
<tr>
<th><input type="text" class="form-control" placeholder="Student Name"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
<th><input type="text" class="form-control" placeholder="#"></th>
</tr>
</thead>
</table>
【问题讨论】:
-
如果您使用的是 Bootstrap,为什么要使用表格?使用内置的网格系统。
标签: twitter-bootstrap html-table bootstrap-4