mheonyae mheonyae - 1 year ago 54
HTML Question

Bootstrap menu button on smaller screen

i am trying to build my navigation bar using bootstrap, but i have the issues that when i have a small screen or window the mobile menu button doesn't appear in the right corner. What did i do wrong?

<nav class="navbar navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#myNavbar">
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>

<div class="collapse navbar-collapse" id="myNavbar">
<ul class="nav navbar-nav navbar-right">
<li><a href="#home">Home</a></li>
<li><a href="#blog">Blog</a></li>
<li><a href="#contact">Contact</a></li>

and my css:

border-bottom:1px solid black;

.navbar-nav > li > a{
color:#1E88E5 !important;
font-size:16px !important;
font-weight:bold !important;
display: block !important;
background-color:#fff !important;

.navbar-nav > li > a:hover{
color:#673ab7 !important;
background-color:#f0f5f5 !important;

Answer Source

You forgot navbar style class in your nav element (navbar-default or navbar-inverse). Styling toggle button depends on this class.

<nav class="navbar navbar-default navbar-fixed-top">