bootstrap table 怎么自适应宽度
<div class="table-responsive">
<table class="table text-nowrap">
<thead>
<tr>
<th> ... </th>
....
</tr>
</thead>
<tbody>
<tr>
<td> ... </td>
....
</tr>
.....
</tbody>
</table>
</div>
其中,表格需要加
<table class="table text-nowrap">
控制内容不换行,表格外层必须有
<div class="table-responsive">
。表格里面的
thead
和
tbody
不能省略,否则Bootstrap表格样式不会被使用。
效果图!!!!

本文介绍了如何使用Bootstrap实现表格内容自适应宽度,并保持内容不换行。关键在于为表格添加`table-responsive`类和`text-nowrap`类。`table-responsive`类确保表格在屏幕较小设备上滚动,而`text-nowrap`类防止表格单元格内的文字换行。同时,强调了`thead`和`tbody`标签的必要性,以确保Bootstrap样式正确应用。

5937

被折叠的 条评论
为什么被折叠?



