在我的 VueJS 应用程序中,我正在使用 Bootstrap 4 构建发票表单,我正在使用这个 code snippet到目前为止一切都很好,但问题是,在设计 UI 样式时,我现在有点糟糕 :)
这里的问题是底部的 totals
部分向左浮动而不是向右浮动。此代码片段取自 Bootstrap 3 代码片段示例,我使用的是 Bootstrap 4,所以这可能就是问题所在。但是,我尝试使用在线转换器将它转换为 Bootstrap 4,但没有一个对我有帮助。非常感谢您的帮助。
这是我要向右浮动的代码。
<div class="row clearfix" style="margin-top:20px">
<div class="float-right col-lg-4">
<table class="table table-bordered table-hover" id="tab_logic_total">
<tbody>
<tr>
<th class="text-center">Sub Total</th>
<td class="text-center">
<input type="number" name="sub_total" placeholder="0.00" class="form-control" id="sub_total" readonly>
</td>
</tr>
<tr>
<th class="text-center">Tax</th>
<td class="text-center">
<div class="input-group mb-2 mb-sm-0">
<input type="number" class="form-control" id="tax" placeholder="0">
<div class="input-group-addon">%</div>
</div>
</td>
</tr>
<tr>
<th class="text-center">Tax Amount</th>
<td class="text-center">
<input type="number" name="tax_amount" id="tax_amount" placeholder="0.00" class="form-control" readonly>
</td>
</tr>
<tr>
<th class="text-center">Grand Total</th>
<td class="text-center">
<input type="number" name="total_amount" id="total_amount" placeholder="0.00" class="form-control" readonly>
</td>
</tr>
</tbody>
</table>
</div>
</div>
最佳答案
你可以使用 offset用于响应地偏移列。由于 #tab_logic_total
表的容器占用了 4 列,我们还剩下 8 列,所以:
<div class="row clearfix" style="margin-top:20px">
<!-- Notice this line: We are offsetting the table by 8 columns -->
<div class="col-lg-4 offset-lg-8">
<table class="table table-bordered table-hover" id="tab_logic_total">
<tbody>
<tr>
<th class="text-center">Sub Total</th>
<td class="text-center">
此时,我们不再需要float-right
类。无论如何,它不会对 flexbox 产生任何影响。
进一步阅读:
关于html - 使用 Bootstrap 4 设计发票表单,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54313323/