twitter-bootstrap Bootstrap 3.0.3 右导航栏和右拉

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20856425/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 19:37:22  来源:igfitidea点击:

Bootstrap 3.0.3 navbar-right and pull-right

htmlcsstwitter-bootstraptwitter-bootstrap-3navbar

提问by Dominic Zukiewicz

I'm working through some Bootstrap tutorials and am using the Bootstrap 3.0.3 version.

我正在学习一些 Bootstrap 教程并使用 Bootstrap 3.0.3 版本。

I've noticed navbar-rightfloats totally to the right, whereas pull-rightseems to work as 3.0's navbar-rightdid.

我注意到navbar-right浮动完全向右,而pull-right似乎像 3.0navbar-right那样工作。

I have placed an example on JSFiddle.

我在JSFiddle上放了一个例子。

According to their blogon 5 Dec 2013, some modifications have been made, so am wondering if I have either structured the HTML classes incorrectly, or if this is the new approach to menu alignment?

根据他们2013 年 12 月 5 日的博客,已经进行了一些修改,所以想知道我是否错误地构造了 HTML 类,或者这是菜单对齐的新方法?

采纳答案by Dominic Zukiewicz

It looks like the 3.0.3 implementation was changed intentionally to cater for this under #11530:

看起来 3.0.3 的实现是有意改变的,以满足#11530下的这个需求:

The workaround is to put a padding on the .navbar-right:

解决方法是在以下位置添加填充.navbar-right

.navbar-right {
   padding-right: 15px;
}

If you try and workaround the issue with pull-right, you will find the responsive design for navbar-collapsewill align the menus right.

如果您尝试使用 解决该问题pull-right,您会发现响应式设计navbar-collapse将使菜单正确对齐。