javascript - Bootstrap 3 Navbar Collapse menu at Left for left and right navbar items -
i have bootstrap 3 navbar left nav items , right nav items (as shown below).
when collapsed, want both navbar-toggle (aka 'hamburger menu') , items left aligned.
my code far:
<nav class="navbar navbar-default custom-navbar" role="navigation"> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> </div> <div class="navbar-collapse collapse"> <ul class="nav navbar-nav"> <li><a href="#">left</a></li> <li><a href="#about">left</a></li> </ul> <ul class="nav navbar-nav pull-right"> <li><a href="#about">right</a></li> <li><a href="#contact">right</a></li> </ul> </div> </nav>
the css have navbar-toggle on left is:
@media (max-width:767px) { .custom-navbar .navbar-right { float: right; padding-right: 15px; } .custom-navbar .nav.navbar-nav.navbar-right li { float: left; } .custom-navbar .nav.navbar-nav.navbar-right li > { padding:8px 5px; } .custom-navbar .navbar-toggle { float: left; margin-right: 0 } .custom-navbar .navbar-header { float: left; width: auto!important; } .custom-navbar .navbar-collapse { clear: both; float: none; } }
i have added "pull-right" style have items aligned, no success.
the "navbar-right" works badly. in fact, it, have both right-hand items on same row. using "pull-right" work single rows, still stay on right.
this leaves me with:
- the hamburger menu on left (as desired),
- the navbar-left items on left (as desired),
- the navbar right items are still on right (i want fixed!).
the final result:
the code snippet here.
i've made few adjustments css , markup can view here.
one thing i'd point out pull-right
, other pull
, push
classes rearranging grid columns.
Comments
Post a Comment