bootstrap表格内容居中
时间: 2023-07-01 16:25:09 浏览: 51
要让 Bootstrap 表格中的内容居中,可以在表格中使用 CSS 居中文本。可以使用以下代码:
```html
<table class="table">
<thead>
<tr>
<th>#</th>
<th>First Name</th>
<th>Last Name</th>
<th>Username</th>
</tr>
</thead>
<tbody>
<tr>
<td class="text-center">1</td>
<td class="text-center">Mark</td>
<td class="text-center">Otto</td>
<td class="text-center">@mdo</td>
</tr>
<tr>
<td class="text-center">2</td>
<td class="text-center">Jacob</td>
<td class="text-center">Thornton</td>
<td class="text-center">@fat</td>
</tr>
<tr>
<td class="text-center">3</td>
<td class="text-center">Larry</td>
<td class="text-center">the Bird</td>
<td class="text-center">@twitter</td>
</tr>
</tbody>
</table>
```
在每个表格单元格中添加`text-center`类可以使内容居中。