【发布时间】:2017-07-17 05:46:15
【问题描述】:
我有一个引导 (3.3.7) 数据表,我想在所有 td 上放置相同的宽度。最终,我想让所有具有 3 个单元格的行到达表格的右侧,并在每个单元格中保持相同的宽度。我进行了大量研究以找到类似的东西但失败了,因此非常感谢任何帮助。
以下是我想将我的表格更改为:
.col-2 { width: 50%; }
.col-3 { width: 33.3%; }
.col-4 { width: 25%; }
.col-5 { width: 20%; }
.col-6 { width: 16.66666667%; }
table {
margin-top: 50px;
}
thead tr th, td {
text-align: center;
}
.td-parent {
font-weight: bold;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
<div class="container">
<table class="table table-bordered table-striped">
<thead>
<tr>
<th colspan="8">SPECIFICATION</th>
</tr>
</thead>
<tbody>
<tr>
<td class="td-parent" colspan="2">Part Number</td>
<td class="td-parent" colspan="2">Position</td>
<td class="td-parent" colspan="2">Content</td>
</tr>
<tr>
<td class="td-child" colspan="2">CDR1005</td>
<td class="td-child" colspan="2">Front/Rear</td>
<td class="td-child" colspan="2">4 identical pads</td>
</tr>
<tr>
<td class="td-parent col-4" colspan="2">Meritor</td>
<td class="td-parent col-4" colspan="2">Mercedes</td>
<td class="td-parent col-4" colspan="2">Renault</td>
<td class="td-parent col-4" colspan="2">WVA</td>
</tr>
<tr>
<td class="td-child" colspan="2">TBA</td>
<td class="td-child" colspan="2">TBA</td>
<td class="td-child" colspan="2">TBA</td>
<td class="td-child" colspan="2">TBA</td>
</tr>
<tr>
<td class="td-parent" colspan="2">A</td>
<td class="td-parent" colspan="2">B</td>
<td class="td-parent" colspan="2">C</td>
</tr>
<tr>
<td class="td-child" colspan="2">250</td>
<td class="td-child" colspan="2">118</td>
<td class="td-child" colspan="2">28</td>
</tr>
</tbody>
</table>
</div>
【问题讨论】:
标签: html css twitter-bootstrap datatable