yamachan yamachan - 1 month ago 10
CSS Question

Hamburger menu not showing in Bootstrap3

I use

nav
and
nav-bar
in
Bootstrap3
.

<div id="gnav" class="col-xs-9 col-sm-9 col-md-9 col-lg-9">
<nav class="navbar navbar-default" id="" >
<div class="collapse navbar-collapse" id="">
<ul class="nav navbar-nav">


Can I prevent showing the hamburger menu on small device widths?

Instead of the menu, I want to show texts like home, items, contact and so on, like in the desktop view.

Here’s an example of the behaviour I do not want.

Answer

Try this:

Check Demo HERE

HTML:

<nav class="navbar">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">

      <a class="navbar-brand" href="#">Brand</a>
    </div>


    <ul class="nav navbar-nav">
      <li class="active"><a href="#">Link <span class="sr-only ">(current)</span></a></li>
      <li><a href="#">Link</a></li>
      <li class="dropdown">
        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
        <ul class="dropdown-menu">
          <li><a href="#">Action</a></li>
          <li><a href="#">Another action</a></li>
          <li><a href="#">Something else here</a></li>
          <li role="separator" class="divider"></li>
          <li><a href="#">Separated link</a></li>
          <li role="separator" class="divider"></li>
          <li><a href="#">One more separated link</a></li>
        </ul>
      </li>
    </ul>


  </div>
  <!-- /.container-fluid -->
</nav>

CSS:

.nav::after,
.nav::before,
.navbar-header::after,
.navbar::after {
  display: table-caption;
}

.nav.navbar-nav li,
.nav.navbar-nav li a {
  display: inline-block;
}
.navbar-nav .open .dropdown-menu {
    position: absolute;
    background-color: #fff;
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.176);
}