Twitter Bootstrap:如何使顶部固定导航栏留在容器中而不是拉伸? [英] Twitter Bootstrap: How to make top fixed navbar stay in container and not stretch?

查看:34
本文介绍了Twitter Bootstrap:如何使顶部固定导航栏留在容器中而不是拉伸?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 Twitter Bootstrap 和您在指南中看到的常规导航栏:http://twitter.github.io/bootstrap/components.html#navbar

我不希望导航一直向左或向右伸展,而是像指南中那样停留在我可以看到两侧的位置.唯一的区别是它会固定在顶部.

我想知道,如何使它成为一个固定的导航栏,就像我在使用 navbar-fixed-top 类一样?

解决方案

你应该能够做到:

I'm working with Twitter Bootstrap and the regular navbar you see in the guides: http://twitter.github.io/bootstrap/components.html#navbar

I don't want the navigation to stretch all the way left or right but stay where I can see both sides just like in the guide. The only difference is it would be fixed to the top.

I was wondering, how do I make this become a fixed navbar as if I was using the navbar-fixed-top class?

解决方案

You should be able to do:

<div class="navbar-fixed-top container">
  <div class="navbar">
    <div class="navbar-inner">
      <a class="brand" href="#">Title</a>
      <ul class="nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#">Link</a></li>
        <li><a href="#">Link</a></li>
      </ul>
    </div>
  </div>
</div>

这篇关于Twitter Bootstrap:如何使顶部固定导航栏留在容器中而不是拉伸?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
其他开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆