Align button with input forms with labels

后端 未结 2 1784
难免孤独
难免孤独 2021-01-04 23:33

I\'m trying to align a button element with two other input elements with labels. Using the bootstrap snippet below:

相关标签:
2条回答
  • 2021-01-05 00:13

    Instead of an improper label, use the align-self-end class (bootstrap 4 / flexbox) to vertically align the button to the bottom of the column.

    <div class="form-group col-md-2 align-self-end">
      <button class="btn btn-primary" id="btn" name="btn" type="submit">Submit</button>
    </div>
    
    0 讨论(0)
  • 2021-01-05 00:18

    I believe button classes don't work that way.

    Updated: This is silly but it works. And if it works, don't mess with it!

    <div class="form-group col-md-2">
        <label class="control-label" for="btn"></label>
        <button class="btn btn-primary" id="btn" name="btn" type="submit">Submit</button>
    </div>
    
    0 讨论(0)
提交回复
热议问题