【发布时间】:2018-10-31 10:36:55
【问题描述】:
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>
<table class="table table-striped table-hover table-responsive">
<thead>
<th scope="col">column1</th>
<th scope="col">column2</th>
<th scope="col">column3</th>
</thead>
<tbody>
<tr>
<td>item1</td>
<td>item2</td>
<td>item3</td>
</tr>
<tr>
<td>item1</td>
<td>item2</td>
<td>item3</td>
</tr>
</tbody>
</table>
是否可以在不为表格指定 100% 以外的宽度的情况下将该表格居中?我为此找到的大多数答案都使表格的宽度小于 100%。这不是很好,因为如果显示足够大,那么当您将元素居中时,表格仍然看起来没有居中。
【问题讨论】:
标签: css bootstrap-4