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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 00:15:55  来源:igfitidea点击:

Is there a pull-down class for navbar in Twitter Bootstrap 2.3.2?

csstwitter-bootstraptwitter-bootstrap-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-rightpull-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) 与导航栏的底部对齐。

enter image description here

在此处输入图片说明

回答by David Barker

The answer to this really lies in the capabilities of CSS. .pull-rightand .pull-leftboth apply a micro-clearfix and then float the element left or right in Twitter Bootstrap.

这个问题的答案真的在于 CSS 的能力。.pull-right并且.pull-left都应用了微清除修复,然后在 Twitter Bootstrap 中向左或向右浮动元素。

Creating .pull-topand .pull-bottomclass' would not be feasible as the parent elements would need to have a position:relativeapplied, the element would then need man-handled around with topand bottomproperties 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应用,然后元素需要人工处理topbottom属性才能正确放置。替代方案将要求元素具有固定的高度,负边距应用于顶部,高度的一半并top:50%应用。同样,这需要父级为position:relative.

As with any CSS framework, there are just some things you will have to do yourself :-(.

与任何 CSS 框架一样,您必须自己做一些事情:-(。