为什么我的bootstrap导航栏品牌不是内联

时间:2016-05-13 20:26:40

标签: html css twitter-bootstrap

<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <title>Bootstrap 101 Template</title>

    <!-- Bootstrap -->
    <link href="css/bootstrap.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
      <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
      <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->

    <style>


    </style>
  </head>


<body>


<div class="navbar navbar-default">

  <div class="container">

    <div class="navbar-header">
        <button class="navbar-toggle" data-toggle="collapse" data-target="navbar-collapse">
            <span class="icon bar"></span>
            <span class="icon bar"></span>
            <span class="icon bar"></span>
        </button>

      <a class="navbar-brand" href="#">MyBinge</a>
    </div>

    <div class="collapse navbar-collapse">

    </div>

 <ul class="nav navbar-nav">
      <li class="active"><a href="#">get started</a></li>
      <li><a href="#">tell us</a></li>
      <li><a href="#">about this project</a></li>
</ul>




  </div>
</div>
<!-- Latest compiled and minified JavaScript -->
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script>


</body>

</html>

我正在试图弄清楚为什么我的导航栏品牌与其他导航栏内容不符。我已经尝试过这篇文章Why is my bootstrap navbar not displaing inline?

中的解决方案

提前谢谢! :)

2 个答案:

答案 0 :(得分:1)

不要在ul之前关闭div。像这样包含带有.nav .navbar-nav类的ul

<div class="collapse navbar-collapse">
  <ul class="nav navbar-nav">
     <li class="active"><a href="#">get     
       started</a></li>
      <li><a href="#">tell us</a></li>
      <li><a href="#">about this project</a></li>
  </ul>
</div>

 

答案 1 :(得分:0)

我自己设法解决了这个问题。 我在ul列表之前关闭了[{'title':title, 'date':date} for title,date in DICT_FORM] 的div。我真的很喜欢编码,但我希望这可以帮助某人