pekpon
pekpon

Reputation: 769

Show icons in the collapsed navbar in Bootstrap 3

I want to build a bootstrap 3 navbar like the facebook app, with some icons. The problem is that when the bar its collapsed, all the icons are hidden. If I put the icons outside from <div class="collapse navbar-collapse"> the icons are out and not hidden, but the <ul><li> doen't work and put my icons vertically.

If its possible I want also to align the icons in the center:

enter image description here

Thats all! Thanks friends ;)

EDIT1:

HTML Code

<div class="navbar navbar-default navbar-fixed-top">
  <div class="navbar-header"><a class="navbar-brand" href="#">Brand</a>
    <a href="#" class="navbar-icon"><span class="glyphicon glyphicon-comment"></span></a>
    <a href="#" class="navbar-icon"><span class="glyphicon glyphicon-edit"></span></a>
      <a 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>
      </a>
    </div>
    <div class="navbar-collapse collapse">
      <ul class="nav navbar-nav navbar-right">
        <li class="active"><a href="#">Home</a></li>
        <li><a href="#">Link</a></li>
        <li><a href="#">More</a></li>
        <li><a href="#">Options</a></li>
      </ul>
    </div> 
</div>

CSS Code

.navbar-header .navbar-icon {
    line-height:50px;
    height:50px;
}

.navbar-header  a.navbar-icon {
    padding:0 10px;
      float:left;
}

JSBin Example

This example is working now. I need to know hw can I align in the center the icons in the mobile responsive version.

Upvotes: 3

Views: 6826

Answers (1)

Bass Jobsen
Bass Jobsen

Reputation: 49044

In the mobile version, wrap your icons in a div with style text-align:center and remove the float left of your icons.

Upvotes: 3

Related Questions