简体   繁体   English

使用Bootstrap 4设置发票表单的样式

[英]Styling an invoice form using Bootstrap 4

In my VueJS application I am building an invoice form using Bootstrap 4, I am using this code snippet and everything has been great so far but the problem is that, when it comes to styling a UI I kind of suck at the moment :) 在我的VueJS应用程序中,我正在使用Bootstrap 4构建发票表单,正在使用此代码段 ,到目前为止一切都很好,但是问题是,当涉及到样式UI时,我现在有点烂:)

The problem here is that the bottom totals part is floating to the left instead of to the right. 这里的问题是,底部totals部分浮动在左侧而不是右侧。 This code snippet has been taken from a Bootstrap 3 code snippet samples and I am using Bootstrap 4 so probably this is the issue. 此代码段摘自Bootstrap 3代码段样本,而我正在使用Bootstrap 4,因此可能是问题所在。 However, I've tried converting it to Bootstrap 4 using online converters but none of them helped me. 但是,我尝试使用在线转换器将其转换为Bootstrap 4,但没有一个对我有所帮助。 I would appreciate your help. 多谢您的协助。

This is the code that I want to float to the right. 这是我想向右浮动的代码。

<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>

You could use offset for responsively offsetting the columns. 您可以使用offset来自适应地偏移列。 Since the container of #tab_logic_total table is taking up 4 columns, we have 8 left, so: 由于#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">

At this point, we no longer need the float-right class. 在这一点上,我们不再需要float-right类。 It won't have any effect on flexbox anyway. 无论如何,它对flexbox不会有任何影响。

Further readings: 进一步阅读:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM