将导航项浮动到Bootstrap 4的右侧? [英] Float nav items to the right in Bootstrap 4?
本文介绍了将导航项浮动到Bootstrap 4的右侧?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
您如何将Bootstrap 4导航栏的右侧导航项推入?我尝试了float-*-right,但是没有用.
How do you push to the right nav items of a Bootstrap 4 navbar? I tried float-*-right but did not work.
<nav class="navbar navbar-static-top navbar-dark bg-inverse float-*-right">
<a class="navbar-brand" href="#">Project name</a>
<ul class="nav navbar-nav">
<li class="nav-item active">
<a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">About</a>
</li>
<li class="nav-item">
<a class="nav-link" href="#">Contact</a>
</li>
</ul>
</nav>
我需要将导航项向右对齐.
I need to align the nav items to the right.
推荐答案
向ul添加'float-xs-right'类
Add 'float-xs-right' class to the ul
<ul class="nav navbar-nav float-xs-right">
您可以从包含的nav标记中删除"float-*-right",因为它在那里没有执行任何操作
You can remove 'float-*-right' from the containing nav tag since it's not doing anything there
http://www.bootply.com/OnvcimHYD7
这篇关于将导航项浮动到Bootstrap 4的右侧?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文