html - 使用 Bootstrap 4 设计发票表单
问题描述
在我的 VueJS 应用程序中,我正在使用 Bootstrap 4 构建发票表单,我正在使用这个代码片段,到目前为止一切都很好,但问题是,当涉及到 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
table 的容器占用了 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 产生任何影响。
进一步阅读:
推荐阅读
- isabelle - 证明包含集合元素的情况
- domain-driven-design - DDD:如何保存聚合的顺序?
- flutter - 如何保持边框原色
- sql - 将数据从一个表动态复制到另一个表
- tensorflow - 在调用 seq2seq_model 来获得训练和测试预测时,我得到了这个错误?
- java - 由于 JMS 目标,从 NetBeans 11.3 到 Payara4/5 的部署缓慢?
- windows - Robotframework Windows 10:为什么测试状态(通过/失败)不是绿色/红色
- web2py - 如何在 web2py 的 SmartGrid 中隐藏自动生成的子列?
- android - 如何在android库的片段中添加按钮和textView
- python-3.x - 发生异常:NotImplementedError