Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter-Bootstrap navbar height too small

The default height of navbar in Twitter-Bootstrap is too small. When height is increased, it encroaches the divs below. How can I increase the height of the navbar that slides the entire page down? If this is possible, how to place navbar links to top / bottom of the navbar.

like image 678
Gattoo Avatar asked Mar 29 '12 10:03

Gattoo


3 Answers

I'm pretty sure I don't love this solution but it works for the amount of time I have to spend on this.

.navbar .container { height: 2em; }

I had to also add some padding-top in the same selector to get things inside the navbar to vertically align nicely.

edit: I just re-read your question and saw you're having trouble with the "divs below". In doing this you need to adjust padding on the body tag as well, e.g.

body { padding-top: 6em; }

per the Twitter Bootstrap docs on Navbar:

When you affix the navbar, remember to account for the hidden area underneath. Add 40px or more of apdding to the <body>. Be sure to add this after the core Bootstrap CSS and before the optional responsive CSS.

like image 80
Chris Avatar answered Oct 01 '22 17:10

Chris


Adding a padding like that is not enough if you're using responsive bootstrap. In this case when you resize your window you'll get a gap between top of the page and navbar. A proper solution looks like this:

body {
  padding-top: 60px;
}
@media (max-width: 979px) {
  body {
    padding-top: 0px;
  }
}

Source: Twitter Bootstrap - top nav bar blocking top content of the page

like image 39
jpillora Avatar answered Oct 01 '22 18:10

jpillora


you can try this one. it works in any size of display.

.navbar .container { min-height: 83px; }


.navbar-fixed-top {
    position:static;
    margin-bottom:20px;
    }
like image 25
Faisal Khan Samrat Avatar answered Oct 01 '22 17:10

Faisal Khan Samrat