How to put <li> element below hamburger icon?

147 views Asked by At

How do you put list element 'Home' below hamburger icon and Logo in Bootstrap 4 in mobile mode? I tried displaying Logo as style="display: block" but did not work.

<div class="container">
  <nav class="navbar navbar-light bg-faded">
    <button class="navbar-toggler hidden-sm-up float-xs-left" type="button" 
    data-toggle="collapse" data-target="#navbar-header"     
    aria-controls="navbar-header" 
    aria-expanded="false" aria-label="Toggle navigation"></button>
    <a class="navbar-brand hidden-md-up" href="/">Logo</a>
    <div class="collapse navbar-toggleable-xs" id="navbar-header">
      <ul class="nav navbar-nav">
        <a class="navbar-brand hidden-sm-down" href="/">Logo</a>
        <li class="nav-item {% block navhome %}{% endblock %}">
          <a class="nav-link float-left" href="/">Home <span 
           class="sr-only">(current)</span></a>
        </li>
1

There are 1 answers

0
Carol Skelly On

If you want it to stack vertically (as it did in 3.x) you have to add some additional CSS for Bootstrap 4.

@media(max-width:576px) {
    .navbar .navbar-nav>.nav-item {
        float: none;
        margin-left: .1rem;
    }
    .navbar .navbar-nav {
        float:none !important;
    }
    .navbar .collapse.in, .navbar .collapsing  {
        clear:both;
    }
}

http://www.codeply.com/go/JyrJRy93P7

Also, explained in this anwser.