Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to add own icons in bootstrap navbar

Working on a project, where i started on the navbar. The thing i am wondering if its possible to add my own icons right next to each of the menu bars ? For example this icons: https://www.dropbox.com/sh/0be3c7ub4245kd6/zNMrvFi6Wq

Like this:

enter image description here

  • DEMO

Code:

<!-- Fixed navbar -->
    <div class="navbar navbar-default navbar-fixed-top" role="navigation">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">Project name</a>
        </div>
        <div class="navbar-collapse collapse">
          <ul class="nav navbar-nav">
            <li class="active"><a href="#">Home</a></li>
            <li><a href="#about">About</a></li>
            <li><a href="#contact">Contact</a></li>

          </ul>

        </div><!--/.nav-collapse -->
      </div>
    </div>

    <div class="container">

      <!-- Main component for a primary marketing message or call to action -->
      <div class="jumbotron">
        <h1>Navbar example</h1>
        <p>This example is a quick exercise to illustrate how the default, static and fixed to top navbar work. It includes the responsive CSS and HTML, so it also adapts to your viewport and device.</p>
        <p>To see the difference between static and fixed top navbars, just scroll.</p>
        <p>
          <a class="btn btn-lg btn-primary" href="../../components/#navbar" role="button">View navbar docs &raquo;</a>
        </p>
      </div>

    </div> <!-- /container -->
like image 925
user3270211 Avatar asked Mar 24 '14 18:03

user3270211


1 Answers

Ok @TrevorOrr answer for Bootstrap standard glyphs, but remember to envelope <span> tag inside the <a> tag. Example:

<nav class="navbar navbar-inverse navbar-fixed-top" role="navigation">
  <div class="navbar-collapse collapse">
    <ul class="nav navbar-nav navbar-left">
      <li><a href="#">Envelope icon: <span class="glyphicon glyphicon-envelope"></span></a></li> 
    </ul>
  </div>
</nav>    

If you do not include the <span> inside the anchor, the glyph is not displayed.

like image 164
Giorgio Calzolato Avatar answered Sep 28 '22 08:09

Giorgio Calzolato