我目前正在使用 bootstrap 处理一个表,我想隐藏或删除该表中的一个单元格。
屏幕:http://perche.jeremy.free.fr/tab.png (我发链接是因为发不了图^^) 所以我想隐藏或删除红色的单元格,我没有看到任何解决方案...
编辑:
<div class="widget stacked widget-table action-table">
<div class="widget-content">
<table class="table table-striped table-bordered">
<thead>
<tr>
<th></th>
<th>Avant</th>
<th>Aujourd'hui</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="3" class="text-center" style="background-color:#C0C0C0;"><strong>Catégorie 1</strong></td>
</tr>
<tr>
<td>Check1</td>
<td>20</td>
<td>40</td>
</tr>
<tr>
<td>Check1</td>
<td>20</td>
<td>40</td>
</tr>
<tr>
<td colspan="3" class="text-center" style="background-color:#C0C0C0;"><strong>Catégorie 2</strong></td>
</tr>
<tr>
<td>Check2</td>
<td>Oui</td>
<td>Oui</td>
</tr>
<tr>
<td>Check2</td>
<td>Oui</td>
<td>Non</td>
</tr>
</tbody>
</table>
</div>
</div>
最佳答案
一个解决方案是隐藏这个额外的 <th></th>
例如
table thead tr th:first-child {
background: none;
}
或与
/* Better if there is content in it, or if there is no background defined at start */
table thead tr th:first-child {
opacity: 0;
}
有几个CSS
方法来做到这一点,但这就是我会做的。希望你明白了。
因为你已经有了一些 inline CSS
如果你不知道如何处理这个 CSS
, 你也可以用 inline CSS
方式,即使它明显不如其他方式干净。
<thead>
<tr>
<th style="opacity: 0;"></th>
<th>Avant</th>
<th>Aujourd'hui</th>
</tr>
</thead>
JsFiddle:
background: none;
解决方案:http://jsfiddle.net/5omkdhnu/1/
opacity: 0;
解决方案:http://jsfiddle.net/5omkdhnu/2/
关于html - Bootstrap 只删除一个单元格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31695414/