如何在Bootstrap 4中将文本和按钮放在同一行上

时间:2018-09-10 10:52:50

标签: bootstrap-4

how to bring the text and button on same line 这是代码:

<div class="col-sm-8">
    <h4>Edit Post</h4> 
    <button type="button" class="btn btn-primary" style="display: inline- 
      block;">Add New</button>
</div>

1 个答案:

答案 0 :(得分:3)

在标题上使用Bootstrap 4 d-inline-block类...

<div class="col-sm-8">
    <h4 class="d-inline-block">Edit Post</h4>
    <button type="button" class="btn btn-primary">Add New</button>
</div>

(可选)使用align-middle与按钮垂直对齐。

https://www.codeply.com/go/F2uHcAPvmx