如何阻止bootstrap导航栏崩溃?

时间:2016-03-13 12:18:50

标签: twitter-bootstrap css3 twitter-bootstrap-3 nav

您好我需要一些关于Bootstrap3的帮助,当我使用我的桌面时,导航栏工作正常。但是一旦我尝试使用手机,导航栏就会崩溃(它的宽度会变小)我该如何解决? 我的网站是http://theboundlesstraveller.neocities.org/index.html 请建议......

更新:代码段

<nav class="navbar navbar-default">
    <div class="container-fluid">
        <ul>
            <li class="active">
                <a href="index.html">Home</a>
            </li>
            <li>
                <a href="mytripjournals.html">My Trip Journals</a>
            </li>
            <li>
                <a href="busy-Peeps.html">Busy-Peeps</a>
            </li>
            <li>
                <a href="lifestyle.html">Lifestyle</a>
            </li>
            <li>
                <a href="contactme.html">Contact Me</a>
            </li>
        </ul>
    </div>
</nav>

2 个答案:

答案 0 :(得分:0)

所以你想要做这样的事情

<强> HTML

<nav class="navbar navbar-default" role="navigation">
    <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>    
    </div>
    <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav navbar-left">
            <li><a href="#itemonelink">Item One</a></li>
            <li><a href="#itemtwolink">Item Two</a></li>
        </ul>
        <ul class="nav navbar-nav navbar-right">
            <li><a href="#signuplink">Signup</a></li>
            <li><a href="#loginlink">Login</a></li>
        </ul>
    </div>
</nav>

演示:JSFiddle

答案 1 :(得分:0)

尝试此修改。

使用您的网站名称

更改Brand中的HTML

<强> HTML

<div class="container">
  <nav class="navbar navbar-default" role="navigation">
        <div class="navbar-header">    
          <div class="navbar-brand navbar-brand-left">Brand</div>
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>   

      </div>
     <div class="navbar-collapse collapse">
        <ul class="nav navbar-nav"> 
          <li><a href="index.html">Home</a></li> 
          <li><a href="mytripjournals.html">My Trip Journals</a></li> 
          <li><a href="busy-Peeps.html">Busy-Peeps</a></li> 
          <li><a href="lifestyle.html">Lifestyle</a></li> 
          <li><a href="contactme.html">Contact Me</a></li> 
        </ul> 
      </div> 
  </nav>
</div> 

<强> CSS

    .navbar-brand-left {
        position: relative;
        left: 10px;
        display: block;
        width: 160px;
        text-align: left;
        background-color: transparent;
    }
@media (min-width: 768px){
    .navbar-nav{
        float:none;
        margin: 0 auto;
        display: table;
        table-layout: fixed;
    }
}