html - 使用 Bootstrap 4 设计发票表单

标签 html css bootstrap-4

在我的 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/

相关文章:

javascript - 尝试在 jQuery 中将类添加到父级时出错

html - 如何将 100vh 的 div 固定到屏幕上?

php - 如何将php表格放入html侧边栏?

javascript - 迭代选择的 DOM 元素

html - 边框或图像不显示在 iphone 的水平滚动条上

asp.net - 使用代码或 css 在文章的正文中插入一个 block

CSS:如何将提示框(a:悬停)向左移动?

twitter-bootstrap - 当我使用渐变时,bootstrap btn 背景在点击时闪烁

css - 将面包屑修复到标题

css - 如何使用 bootstrap 或 css 制作类似 2 行 2 列表格的加号? (如图片链接所示)