我正在尝试自定义我的 Bootstrap 表。如果 table 高度大于某个高度,我想要 <tbody>
滚动而不滚动表格的其余部分。我已经尝试了几乎所有我能想到的方法,但 table 甚至不会改变尺寸。
有谁知道我需要修改哪些类来解决这个问题?这是我在表格中使用的元素:
<div class="table-responsive">
<table class="table table-condensed">
<colgroup>
<col class="col-xs-1"/>
<col class="col-xs-1"/>
</colgroup>
<thead>
<tr>
<th></th>
<th></th>
</tr>
</thead>
<tbody>
<tr>
<td></td>
<td></td>
</tr>
<tr>
<td></td>
<td></td>
</tr>
</tbody>
</table>
</div>
最佳答案
我在使用 Bootstrap 2.3.2 时遇到了类似的问题。我不得不对我的表格进行一些修改,但是我找到了一个带有完整 css 解决方案的非常好的网站: http://www.cssbakery.com/2010/12/css-scrolling-tables-with-fixed.html
我基本上采用了该站点上的 scrollableArea 和 scrollableContainer css 部分,更改了几个类名以匹配我已有的类名,并使用它而不是 Bootstrap 。也许这会有所帮助,也许不会,但绝对是一个不错的选择。
关于css - Bootstrap table tbody 滚动,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22175510/