我的导航栏没有出现

时间:2017-07-07 10:01:05

标签: html bootstrap-4

我在Codepen上这样做, 深色导航栏应以我的名字显示为浅色,但不会发生。我正在关注在线的bootstrap 4.0指南。

根据我阅读的指南和示例,我已经包含了所有必要的类。

<div id="entire" class="container-fluid">

  <div id="topbar">
    <nav class="navbar navbar-brand navbar-inverse bg-inverse">
      <h1>Vishwad Desai</h1>
    </nav>
  </div>

  <div id="actual">
    <p> Start</p>
  </div>
  <div id="bottom"></div>
</div>

Screenshot

1 个答案:

答案 0 :(得分:4)

您必须确保包含所有necessary CSS and JS files

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>

此外,您必须直接将班级.navbar-brand设置为<h1>元素(而不是<nav>)。请参阅以下工作示例:

&#13;
&#13;
<!-- include all the required CSS and JS files -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" integrity="sha384-rwoIResjU2yc3z8GV/NPeZWAv56rSmLldC3R/AZzGRnGxQQKnKkoFVhFQhNUwEyJ" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js" integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.4.0/js/tether.min.js" integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js" integrity="sha384-vBWWzlZJ8ea9aCX4pEW3rVHjgjt7zpkNpZk+02D9phzyeVkE+jo0ieGizqPLForn" crossorigin="anonymous"></script>

<!-- your code -->
<div id="entire" class="container-fluid">
  <div id="topbar">
    <nav class="navbar navbar-inverse bg-inverse">
      <h1 class="navbar-brand">Vishwad Desai</h1>
    </nav>
  </div>
  <div id="actual">
    <p> Start</p>
  </div>
  <div id="bottom"></div>
</div>
&#13;
&#13;
&#13;