【发布时间】:2020-11-15 09:55:17
【问题描述】:
我在一行中有三列。每列都是 lg-6,这使得最后一列跨度低于其他两列。使用 float-right 将此列放置在右侧。但是,每当最后一列(第 2 列)上方的列比第一列获得更多内容时,最后一列(第 3 列)就会向左移动(如下图所示)。有什么办法可以防止列像这样移动吗?强制它保持正确。
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="row d-md-block mt-4 mx-n3 px-4">
<div class="card col-lg-6 col-sm-12 mx-n1 float-left">
<div class="card-header screensCardHeader">
<h4 class="m-0 font-weight-bold text-header">Column 1</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="table_0_view" class="table" width="100%" cellspacing="0">
<thead class="screensThead">
<tr>
<th>#</th>
<th>Namn</th>
</tr>
</thead>
<tbody id="tbody_0_view" class="screenstable screenstableque">
<tr id="2" sport="0" class="screenstablerow">
<td class="viewtd row-id-0">1</td>
<td>Person 1</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="card col-lg-6 col-sm-12 mx-n1 float-right order-1">
<div class="card-header screensCardHeader">
<h4 class="m-0 font-weight-bold text-header">Column 2</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="table_1_view" class="table" width="100%" cellspacing="0">
<thead class="screensThead">
<tr>
<th>#</th>
<th>Namn</th>
</tr>
</thead>
<tbody id="tbody_1_view" class="screenstable screenstableque">
<tr id="3" sport="1" class="screenstablerow">
<td class="viewtd row-id-1">1</td>
<td>Person 2</td>
</tr>
<tr id="4" sport="1" class="screenstablerow">
<td class="viewtd row-id-1">1</td>
<td>Person 3</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div class="card col-lg-6 col-sm-12 mx-n1 float-right justify-content-end">
<div class="card-header screensCardHeader">
<h4 class="m-0 font-weight-bold text-header">Column 3</h4>
</div>
<div class="card-body">
<div class="table-responsive">
<table id="table_2_view" class="table" width="100%" cellspacing="0">
<thead class="screensThead">
<tr>
<th>#</th>
<th>Namn</th>
</tr>
</thead>
<tbody id="tbody_2_view" class="screenstable screenstableque">
</tbody>
</table>
</div>
</div>
</div>
</div>
【问题讨论】:
标签: html css twitter-bootstrap bootstrap-4