Bootstrap导航栏未向右拉

时间:2018-08-21 20:41:58

标签: twitter-bootstrap twitter-bootstrap-3

我刚遇到一个奇怪的问题,我的导航栏不再向右拖动文本:

HTML:

    

    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mainNavBar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
    </button>   

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="mainNavBar">  

    <div class="navbar-header">
       <a class="navbar-brand" href="https://www.brand.com/">Brand</a>
    </div>

    <ul class="nav navbar-nav">

    </ul>

    <ul class="nav navbar-nav navbar-right">
        <li><a href="register.php"><span class="glyphicon glyphicon-user"></span> Register</a></li>
        <li><a href="login.php"><span class="glyphicon glyphicon-log-in"></span> Login</a></li>
    </ul>

</div>

我所做的就是添加切换代码,以使该网站对移动设备更加友好:

<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#mainNavBar">
    <span class="sr-only">Toggle navigation</span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
    <span class="icon-bar"></span>
</button>   

<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="mainNavBar">  

如果我将代码从上面拿走,导航栏将正常运行,我可能会错过一些小的东西吗?在查看时,一切看起来都很好,但也许其他人可以看到我错过的问题,感谢任何帮助。

0 个答案:

没有答案