如何在引导程序中将div推到行尾附近?

时间:2018-10-15 11:03:48

标签: html css twitter-bootstrap bootstrap-4

我有这样的标记:

<div class="wrapper">
    <div class="row">
        <div class="col-md-4"></div>
    </div>
    <div class="next-to-div"></div>
</div>

我想将div.next-to-div放在div.col-md-4旁边。如果使用此标记,则显然它将div放到新行。请帮忙!

2 个答案:

答案 0 :(得分:1)

将div.next-to-div放入div.row

<div class="wrapper">
    <div class="row">
        <div class="col-md-4"></div>
        <div class="next-to-div"></div>
    </div>
</div>

答案 1 :(得分:0)

您可以制作容器d-flex并使用justify-content-between来分隔div ...

<div class="wrapper container-fluid d-flex justify-content-between">
    <div class="row flex-grow-1">
        <div class="col-md-4">col 4</div>
    </div>
    <div class="next-to-div">next dov</div>
</div>

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