右侧的boostrap navbar-nav不起作用

时间:2017-09-12 16:09:43

标签: css

我使用bootstrap导航栏,但它不能正常工作。我想要一个左边是品牌的菜单,右边是菜单项和表格。但正如您在示例中所看到的那样:“https://jsfiddle.net/bnrgcupL/”菜单项出现在品牌旁边。你知道怎么解决这个问题吗?

HTML:

<nav class="navbar navbar-expand-md navbar-light bg-light">
  <a class="navbar-brand" href="#">Navbar</a>
  <button class="navbar-toggler" 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>

  <div class="collapse navbar-collapse justify-content-end" id="navbarSupportedContent">
    <ul class="navbar-nav mr-auto">
      <li class="nav-item active">
        <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a>
      </li>
      <li class="nav-item">
        <a class="nav-link" href="#">Link</a>
      </li>
      <li class="nav-item">
        <a class="nav-link disabled" href="#">Disabled</a>
      </li>
    </ul>
    <form class="form-inline my-2 my-lg-0">
      <input class="form-control mr-sm-2" type="text" placeholder="Search" aria-label="Search">
      <button class="btn btn-outline-success my-2 my-sm-0" type="submit">Search</button>
    </form>
  </div>
</nav>

1 个答案:

答案 0 :(得分:0)

mr-auto声明中删除课程<ul class="navbar-nav">。 如果您愿意,可以添加pull-right课程,但不是真的需要。