bootstrap 4 中的右拉替换不起作用
pull-right replacement in bootstrap 4 does not work
我 read pull-right
class 已被删除
取而代之的是 class 等 .float-{sm,md,lg,xl}-{left,right,none}
- 正如 中所见。
但我无法让它工作。
我已经在
https://jsfiddle.net/kneidels/x8Lhmajc/1/
您会在左上角看到 "menu" 这个词,它有一个下拉列表。应该向右浮动
但如您所见,它不起作用。
.row
div 现在在 display:flex
中,这就是浮动无法正常工作的原因!
你可以
1) 将内容包裹在 <div class="col-sm-12></div>
中(这是使用网格的正确方法:如果你不使用 .col-something
你最终会得到负边距和部分您的内容不可见)
2) 使用此处 https://getbootstrap.com/docs/4.0/utilities/flex/ 列出的 flex 实用程序之一,例如 class flex-row-reverse
我设法将 类 col 和 float-right 一起使用,使其适合您的情况。这里是plunker and in your fiddle。但通常情况下,只要 float-right 就足够了。
<div class="col float-right">
<div class="dropdown actionButtons float-right">
//your content
</div>
</div>
如果你只需要移动菜单,包装col-sm-12(md,lg你需要什么)并使用float-right 在示例中(参见此 fiddle)。
<div class="col-md-12"> </div>
可能来晚了一点,但我也过得很辛苦。每当我设法将列放在 "row" class 下时,没有什么能让我向右拉。我想这可行,这是我的解决方案;
<div class="row">
<div class="col order-last">
Whatever
</div>
</div>
我 read pull-right
class 已被删除
取而代之的是 class 等 .float-{sm,md,lg,xl}-{left,right,none}
- 正如
但我无法让它工作。 我已经在 https://jsfiddle.net/kneidels/x8Lhmajc/1/ 您会在左上角看到 "menu" 这个词,它有一个下拉列表。应该向右浮动 但如您所见,它不起作用。
.row
div 现在在 display:flex
中,这就是浮动无法正常工作的原因!
你可以
1) 将内容包裹在 <div class="col-sm-12></div>
中(这是使用网格的正确方法:如果你不使用 .col-something
你最终会得到负边距和部分您的内容不可见)
2) 使用此处 https://getbootstrap.com/docs/4.0/utilities/flex/ 列出的 flex 实用程序之一,例如 class flex-row-reverse
我设法将 类 col 和 float-right 一起使用,使其适合您的情况。这里是plunker and in your fiddle。但通常情况下,只要 float-right 就足够了。
<div class="col float-right">
<div class="dropdown actionButtons float-right">
//your content
</div>
</div>
如果你只需要移动菜单,包装col-sm-12(md,lg你需要什么)并使用float-right 在示例中(参见此 fiddle)。
<div class="col-md-12"> </div>
可能来晚了一点,但我也过得很辛苦。每当我设法将列放在 "row" class 下时,没有什么能让我向右拉。我想这可行,这是我的解决方案;
<div class="row">
<div class="col order-last">
Whatever
</div>
</div>