无法让导航栏出现在Bootstrap中

时间:2016-12-06 07:27:35

标签: html css twitter-bootstrap

我已经尝试了一切让我的导航栏与我的主页和主页一起显示。

当我使用以下代码时,即使我确定我的CSS工作正常,我也无法显示导航栏。所有这一切都发生在我的'关于'链接到最右边,我的'家'走到左边,但是没有导航条可以看到。

有谁知道为什么我的导航栏css没有激活?即使所有其他bootstrap css都功能正常?

<!DOCTYPE html>
<html>
  <head>
    <title>Attempting to get nav bar to work</title>
    <meta charset="UTF-8">
    <link rel="stylesheet" type="text/css" href="../Bootstrap/css/bootstrap.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
    <script src="../Bootstrap/js/bootstrap.js"></script>
  </head>
  <body>

    <div class='navbar navbar-default'>
      <a href='../' class='navbar-brand'>
        Home
      </a>
      <ul class='nav navbar-nav navbar-right'>
        About
      </ul>
    </div>

  </body>
</html>

1 个答案:

答案 0 :(得分:1)

好的,这就是我从Bootstrap获得的内容,它与你所拥有的完全不同:

&#13;
&#13;
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://code.jquery.com/jquery-2.2.4.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<nav class="navbar navbar-default">
  <div class="container-fluid">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Home</a>
    </div>
    <div id="navbar" class="navbar-collapse collapse">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#">About</a></li>
        <li><a href="#">Contact</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li class="dropdown-header">Nav header</li>
            <li><a href="#">Separated link</a></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li class="active"><a href="./">Default <span class="sr-only">(current)</span></a></li>
        <li><a href="../navbar-static-top/">Static top</a></li>
        <li><a href="../navbar-fixed-top/">Fixed top</a></li>
      </ul>
    </div><!--/.nav-collapse -->
  </div><!--/.container-fluid -->
</nav>
&#13;
&#13;
&#13;

全屏查看摘录。