这是我的代码。我想做的是将这张桌子放在容器的中心。但相反,当我使用“容器”类时,它默认向左对齐,并且当我对 div 使用“容器流体类”时,它使用全宽度。我想将桌子水平居中。有人可以帮忙吗?
<!-- Container (Pricing Section) -->
<div id="pricing" class="container-fluid">
<table class="table table-bordered table-striped">
<thead><tr>
<th>Material Name</th>
<th>Rate (INR)</th>
</tr>
</thead>
<tbody style="">
<tr>
<td>Books</td>
<td>7.00(per KG)</td>
</tr>
<tr>
<td>Soft Plastic</td>
<td>15.00(per KG)</td>
</tr>
<tr>
<td>Hard Plastic</td>
<td>2.00(per KG)</td>
</tr>
</tbody>
</table>
<div>
这是一个屏幕截图。
我知道“container-fluid”使用全宽度,但我也只使用了“container”类,但它没有帮助。请指教。
无论表格或屏幕的大小如何,都可以使用此 Bootstrap 行/列组合,无需 CSS:
<div class="row justify-content-center">
<div class="col-auto">
<table class="table table-responsive">
....table stuff....
</table>
</div>
</div>
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)