CSS Twitter Bootstrap 2.3.2 中是否有导航栏的下拉类?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18641810/
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
Is there a pull-down class for navbar in Twitter Bootstrap 2.3.2?
提问by Drake Guan
There are pull-rightand pull-leftclasses to align block elements. I'm wondering if there is corresponding pull-topand pull-bottomworkable for navbar?
有pull-right和pull-left类来对齐块元素。我想知道导航栏是否有相应的上拉和下拉可用?
<header id="navbar" role="banner" class="navbar navbar-fixed-top">
<div class="navbar-inner">
<div class="container">
<!-- .btn-navbar is used as the toggle for collapsed navbar content -->
<a class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</a>
<a class="logo pull-left" href="/" title="Home">
<img src="logo.png" alt="Home">
</a>
<div class="nav-collapse collapse">
<nav role="navigation">
<ul class="menu nav">
<li>...</li>
</ul>
</nav>
</div>
</div>
</div>
</header>
To goal is to align the menu (ul.nav
) to the bottom of navbar.
目标是将菜单 ( ul.nav
) 与导航栏的底部对齐。
回答by David Barker
The answer to this really lies in the capabilities of CSS. .pull-right
and .pull-left
both apply a micro-clearfix and then float the element left or right in Twitter Bootstrap.
这个问题的答案真的在于 CSS 的能力。.pull-right
并且.pull-left
都应用了微清除修复,然后在 Twitter Bootstrap 中向左或向右浮动元素。
Creating .pull-top
and .pull-bottom
class' would not be feasible as the parent elements would need to have a position:relative
applied, the element would then need man-handled around with top
and bottom
properties to have it placed properly. The alternatives would require the element to have a fixed height with negative margin applied to the top, of half the height and top:50%
applied. Again this would need the parent to be position:relative
.
创建.pull-top
和.pull-bottom
分类是不可行的,因为父元素需要position:relative
应用,然后元素需要人工处理top
和bottom
属性才能正确放置。替代方案将要求元素具有固定的高度,负边距应用于顶部,高度的一半并top:50%
应用。同样,这需要父级为position:relative
.
As with any CSS framework, there are just some things you will have to do yourself :-(.
与任何 CSS 框架一样,您必须自己做一些事情:-(。