简体   繁体   English

Twitter Bootstrap 3-Affix顶部导航栏不起作用

[英]Twitter Bootstrap 3 - Affix Top Navigation bar is not working

I'm using Twitter Bootstrap 3 framework. 我正在使用Twitter Bootstrap 3框架。 Look at this FIDDLE and you'll understand my problem. 看看这个FIDDLE ,您就会了解我的问题。

  1. Affix is not working properly. 词缀无法正常运行。
  2. Navigation Items are not in horizontal. 导航项不是水平的。

Please help me in resolving this issue. 请帮助我解决此问题。

And one more help, if there's any bootstrap classes list available that'd help me too. 还有一个帮助,如果有可用的引导程序类列表对我也有帮助。

HTML CODE: HTML代码:

<div class="container" data-spy="affix" data-offset-top="100" id="nav">
    <div class="navbar well">
        <div class="navbar-inner">
            <div class="container">
                <div class="col-md-12">
                     <ul class="nav">
                        <li class="active"><a href="#">Home</a></li>
                        <li><a href="#">Link</a></li>
                        <li><a href="#">Contact</a></li>
                     </ul>
                </div>
            </div> 
        </div> 
    </div> 
</div>

First of all, for the menu, you shouldn't use divs with classes "container" and " col-md-12 ". 首先,对于菜单,不应将div与"container"和“ col-md-12 ”类一起使用。 This is just a suggestion. 这只是一个建议。

The fastest way to solve your problem, is to rewrite the next css: 解决问题的最快方法是重写下一个CSS:

.nav > li {
    position: relative;
    display: inline-block;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM