如何在Twitter的Bootstrap中正确定位额外的subnav?

时间:2012-02-19 17:21:22

标签: css twitter-bootstrap

我创建了自己的.subnav-fixed(就像Twitter的Bootstrap文档css):

@media (min-width: 980px) {
  .subnav-fixed {
    background-image: url(pic146x120.png);
    height: 146px;
    width: 120px;    
    position: fixed;
    top: 0px;
    left: 0;
    right: 0;
    z-index: 1020; /* 10 less than .navbar-fixed to prevent any overlap */
  }
}

我尝试以与其他元素定位相同的方式定位:

<div class="navbar navbar-fixed-top">
  <div class="navbar-inner">
    <div class="container">
      <div class="row offset1 span6">
        <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="brand" href="index.html">Project</a>
        <div class="nav-collapse">
          <ul class="nav">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>
          </ul>
        </div><!--/.nav-collapse -->
      </div>
    </div>
  </div>
  <div class="row">
    <div class="subnav-fixed offset1 span6">
      test test test test test test test test test test test test test test test 
    </div> 
  </div>
</div>

使用此类代码(offset1 span6)我希望我的.subnav-fixed位于左侧的同一位置,即品牌所在的位置。但事实并非如此 - demo

1 个答案:

答案 0 :(得分:0)