loretoparisi loretoparisi - 1 year ago 85
CSS Question

Bootstrap 3 Navbar Collapse menu at Left for left and right navbar items

I have a Bootstrap 3 navbar with left nav items and right nav items (as shown below).

Left and Right nav items

When collapsed, I want both the navbar-toggle (AKA the 'hamburger menu') and its items to be left aligned.

My code so 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>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="#">Left</a></li>
<li><a href="#about">Left</a></li>
<ul class="nav navbar-nav pull-right">
<li><a href="#about">Right</a></li>
<li><a href="#contact">Right</a></li>

The CSS to have the navbar-toggle on the 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 > a {
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 a "pull-right" style to have the items aligned, with no success.

The "navbar-right" works badly. In fact, with it, I will have both right-hand items on the same row.
Using "pull-right" they work as single rows, but still stay on the right.

This leaves me with:

  • The hamburger menu on the left (as desired),

  • The navbar-left items on the left (as desired),

  • The navbar right items are still on the right (I want this to be fixed!).

The final result:

The last two elements are still on the right

The code snippet is here.

Answer Source

I've made a few adjustments to your CSS and markup which you can view here.

One thing I'd point out is that pull-right and the other pull and push classes are for rearranging grid columns.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download