Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

bootstrap 4 nav doesn't display hamburger on resize

I've figured how to align the menu items to the right, but when resized the navbar-toggler doesnt appear.

Code:

<nav class="navbar navbar-toggleable-md">
    <a asp-controller="Home" asp-action="Index" class="navbar-brand">
        <img class="brand_img" src="/Graphic/logo.jpg" style="margin-left:-1px;margin-right:6px;" />
        <span class="brand_name">Lundbeck Consulting</span>
    </a>
    <button type="button" class="navbar-toggler navbar-toggler-right" data-toggle="collapse" data-target="#navbarFullCollapse" >
        <span class="navbar-toggler-icon"></span>
    </button>
    <div class="collapse navbar-collapse justify-content-end" id="navbarFullCollapse">
        <div class="nav navbar-nav">
            <a class="nav-item nav-link navbar_item" asp-controller="Home" asp-action="About">Om LC</a>
            <a class="nav-item nav-link navbar_item" asp-controller="Project" asp-action="Index">Prosjekter</a>
            <a class="nav-item nav-link navbar_item" asp-controller="Home" asp-action="Contact">Kontakt</a>
        </div>
    </div>
</nav>

Please see http://core.lundbeckconsulting.no for demo

thanks in advance!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Updated 2018

The hamburger is there, but it's not visible because the Navbar needs a color, or change the toggler color.

<nav class="navbar navbar-toggleable-md bg-faded navbar-light">
    ..
</nav>
  • Use navbar-dark to produce light/white colored links and toggler
  • Use navbar-light to produce dark/gray colored links and toggler

In Bootstrap 4.0.0 navbar-toggleable- has changed to navbar-expand-, but navbar-light and navbar-dark still work the same way...

<nav class="navbar navbar-expand-md navbar-light bg-light">
    ..
</nav>

also see: Bootstrap navbar: nothing is displayed on smaller devices


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...