twitter-bootstrap Bootstrap navbar-toggler-icon 不可见但运行正常

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/46515366/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 01:05:23  来源:igfitidea点击:

Bootstrap navbar-toggler-icon not visible but functioning normally

htmlcsstwitter-bootstraphandlebars.js

提问by HM04

I am trying to get my bootstrap navbar implemented into my handlebars layout file. I've noticed some weird things happening with bootstrap and this is no exception. Once I shrink my window to a size where the navbar-toggler-icon should show, it is not visible, but it is still functioning there like it should, I just can't see it.

我正在尝试将我的引导导航栏实现到我的把手布局文件中。我注意到引导程序发生了一些奇怪的事情,这也不例外。一旦我将窗口缩小到导航栏切换图标应该显示的大小,它就看不到了,但它仍然像它应该的那样在那里运行,我只是看不到它。

Here is my entire layout.hbs class:

这是我的整个 layout.hbs 类:

<!DOCTYPE html>
<html lang="en">
  <head>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
    <link rel="stylesheet" href="/stylesheets/style.css">
  </head>
  <body>
    <nav id="navigation" class="navbar navbar-inverse">
      <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" 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>
        </div>
    </nav>
    {{{body}}}
    <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
  </body>
</html>

Here is an example of whats happening: Picture of whats happeningI was told changing my navbar class to navbar-inversewould make it appear but I had no luck with this either.

这是发生了什么的一个例子:发生了什么的 图片我被告知改变我的导航栏类navbar-inverse会使其出现,但我也没有运气。

回答by Fabian Beyerlein

Try using navbar navbar-lightinstead of navbar navbar-inverse.

尝试使用navbar navbar-light而不是navbar navbar-inverse.

Bootstrap 4 is a major rewrite of the older Bootstrap and this was changed

Bootstrap 4 是对旧 Bootstrap 的主要重写,这已更改

Bootstrap Migration guide

Bootstrap 迁移指南

回答by Sachin Kumar

For Bootstrap 4: change your bootstrap class on this line <nav id="navigation" class="navbar navbar-inverse">as shown below:

对于 Bootstrap 4:在这一行更改您的引导程序类<nav id="navigation" class="navbar navbar-inverse">,如下所示:

  • <nav id="navigation" class="navbar navbar-dark bg-dark">
  • <nav id="navigation" class="navbar navbar-dark bg-dark">