Bootstrap Navbar不显示列表项

时间:2017-06-13 08:52:22

标签: html twitter-bootstrap navbar

引导导航栏未显示列表项,切换按钮不起作用。

 <nav class="navbar navbar navbar-default fixed-top navbar-light bg-faded ">
 <button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <a class="navbar-brand" href="#"><img src="https://image.ibb.co/fF1j0v/anchor.png" width="30" height="30" class="d-inline-block align-top" alt=""> ShivaWorks</a>
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#about">About<span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#portfolio">Portfolio</a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#contact">Contact</a>
      </li>
    </ul>
  </div>
</nav>

我错过了什么吗?请帮忙。

1 个答案:

答案 0 :(得分:1)

您尚未在代码中使用bootstrap.jsjquery.js

</html>

之前的代码末尾使用

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>