jQuery Bootstrap 图标栏未显示

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/19206741/
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-08-26 23:25:56  来源:igfitidea点击:

Bootstrap icon-bar not showing

javascriptjqueryhtmlcsstwitter-bootstrap

提问by elkebirmed

the icon-bar in the navbar menu of Bootstrap not showing when resizing the browser:

调整浏览器大小时,Bootstrap 导航栏菜单中的图标栏未显示:

http://jsbin.com/ixAqinA/1/

http://jsbin.com/ixAqinA/1/

   <section class="container">
    <div class="navbar-header">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-ex1-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a href="/">
        brand
      </a>
    </div>
    </section>

you can see the JSBin example live: http://jsbin.com/ixAqinA/1/

您可以实时查看 JSBin 示例:http: //jsbin.com/ixAqinA/1/

回答by Sanjo

You have to wrap it inside

你必须把它包在里面

<nav class="navbar navbar-default" role="navigation"></nav>

回答by Scone

I had a similar issue, but this solution did not work for me because of changes in Bootstrap.

我有一个类似的问题,但由于 Bootstrap 的变化,这个解决方案对我不起作用。

For Bootstrap 3.1.1, I needed the following style to show the icon bars on a custom colored navbar that is fixed to the top (so .navbar-default doesn't work)

对于 Bootstrap 3.1.1,我需要以下样式来显示固定在顶部的自定义彩色导航栏上的图标栏(因此 .navbar-default 不起作用)

.navbar-toggle .icon-bar{ background-color: #fff;}

Just change #fff for the color you would like to show.

只需将 #fff 更改为您想要显示的颜色。

回答by theoretisch

Bootstrap 4 doesn't use .icon-barany more. There it has to be done like:

Bootstrap 4 不再使用.icon-bar。在那里必须这样做:

<button class="navbar-toggler navbar-toggler-right" 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>

For more details you should look hereor in the documentation of Bootstrap 4

有关更多详细信息,您应该查看此处Bootstrap 4文档