我的可折叠导航栏有什么问题?

时间:2017-03-22 09:57:29

标签: css twitter-bootstrap

*<nav class="navbar navbar-inverse ">
  <div class="container-fluid">
    <div class="navbar-header">
    <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>                        
      </button>
      <a class="navbar-brand" href="#">MRA car Rental</a>
    </div>

    <div class="collapse navbar-collapse" id="myNavbar">
        <ul class="nav navbar-nav">
           <li class="active"><a href="#">Home</a></li>
           <li><a href="#">About</a></li>
           <li><a href="#">Gallery</a></li>
         </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>
  </div>
</nav>*

当我调整浏览器大小并单击按钮时,它不起作用。上面的代码出了什么问题?

1 个答案:

答案 0 :(得分:0)

你有boostraps js和css文件,你可以将它们添加到你的HTML。

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">