<分区>
我正在尝试使用 bootstrap 将表格居中。
这是 html:
<div class="container-fluid">
<table id="total votes" class="table table-hover text-centered">
<thead>
<tr>
<th>Total votes</th>
<th> = </th>
<th>Voter A</th>
<th> + </th>
<th>Voter B</th>
</tr>
</thead>
<tbody>
<tr>
<td>{{ total_votes }}</td>
<td> = </td>
<td>{{ total_voter_a }}</td>
<td> + </td>
<td>{{ total_voter_b }}</td>
</tr>
</tbody>
</table>
</div>
但是,无论我如何调整 css
,表格仍然是左对齐的。我确定我错过了一些简单的东西。我还认为 container-fluid
会让表格跨越整个页面。
这是CSS:
.table th {
text-align: center;
}
.table {
border-radius: 5px;
width: 50%;
float: none;
}