如何在 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
将位于左侧品牌所在的相同位置。但实际上并非如此 - 演示。
I've created my own .subnav-fixed
(like in Twitter's Bootstrap docs, 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 */
}
}
and I try to position that in the same way as other elements are positioned:
<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>
With such code (offset1 span6
) I expect that my .subnav-fixed
would be at the same position from the left, where brand is. But actually it is not so - demo.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
澄清在这里 - https://github.com/twitter/bootstrap/issues/1994
Clarifications are here - https://github.com/twitter/bootstrap/issues/1994