2

I am using nav-bar in Bootstrap 3 framework. Which is the best way to change the height of the navbar.

Should i give a explicit height to the nav bar class or should i set the line height of the elements. I am confused bcos i am using a responsive navbar.

<header id="pageHeader">
  <nav class="navbar navbar-default navbar-inverse navbar" role="navigation">
    <div class="container"><!-- Brand and toggle get grouped for better mobile display -->
      <div class="navbar-header">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> <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="#">Brand</a> </div>

      <!-- Collect the nav links, forms, and other content for toggling -->
      <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <form action="search.php" class="navbar-form navbar-left" role="search">
          <div class="form-group">
            <input type="text" class="form-control" placeholder="Search for Apartments">
          </div>
        </form>
        <ul class="nav navbar-nav navbar-right">
          <li class="active"><a href="#">Link</a></li>
          <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <b class="caret"></b></a>
            <ul class="dropdown-menu">
              <li><a href="#">Action</a></li>
              <li><a href="#">Another action</a></li>
              <li><a href="#">Something else here</a></li>
              <li class="divider"></li>
              <li><a href="#">Separated link</a></li>
            </ul>
          </li>
        </ul>
      </div>
      <!-- /.navbar-collapse --></div>
  </nav>
</header>
Harsha M V
  • 54,075
  • 125
  • 354
  • 529

3 Answers3

4

If you are compiling using SASS you will find a navbar-height mixin available

http://getbootstrap.com/css/#sass

Zenvied
  • 73
  • 1
  • 5
2

instead of giving fixed height i would recommend removing height entirely and giving top and bottom padding to your li elements.

Nishant
  • 821
  • 7
  • 17
1

The height of the Navbar element in Bootstrap 3 can be adjusted by setting the @navbar-height variable.

The full list of Bootstrap 3 Navbar variables are documented here:

http://getbootstrap.com/customize/#navbar

dheeraji
  • 127
  • 1
  • 8