我在这里有一个简单的演示:

<ul>
    <li>One <input class="btn pull-right" value="test"></li>
    <li>Two <input class="btn pull-right" value="test2"></li>
</ul>

我有一个无序的列表和每个列表项目,我希望有文本在左边,然后一个右对齐按钮。我曾尝试使用拉右,但这完全混乱了对齐。我做错了什么?

<链接href=“http://twitter.github.com/bootstrap/assets/cssstrap.css”“terlesheet”/> <德> <li>One <输入级=“btn pullright”值=“测试”></li> <li> 2 < <输入级=“btn -right引体”值=“test2”</li> < /德>


当前回答

用于引导4文档

  <div class="row justify-content-end">
    <div class="col-4">
      Start of the row
    </div>
    <div class="col-4">
      End of the row
    </div>
  </div>

其他回答

用于引导4文档

  <div class="row justify-content-end">
    <div class="col-4">
      Start of the row
    </div>
    <div class="col-4">
      End of the row
    </div>
  </div>

对于bootstrap 5.1.3,属性float-end适用于我:

<div class="row mt-2 float-end">
    <div class="col-md-12">
        <button class="btn btn-warning" >Do something else</button>
        <button class="btn btn-primary ml-2">Do primary action</button>
    </div>
</div>

在推特引导3尝试类右拉

class="btn pull-right"
<p align="right">
<button type="button" class="btn btn-primary">Submit</button>
</p>

对于引导5:

文档:https://getbootstrap.com/docs/5.0/utilities/float/

在元素中使用.float-end进行右对齐。 如果你将ex向右移动一个按钮,并且不希望下面的元素向上滑动,你可能必须在父元素中添加.clearfix。