Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

div doesn't position itself below bootstrap fixed navbar

I have been using bootstrap's navbar css. Below this navbar I have a which I want to put below the navbar. However, why does it always start at the top and not below the navbar? I've looked at twitter bootstrap's example and they were able to have a positioned below the fixed navbar. Here's the link to my website. Any idea why this is?

Here's the html that I have now:

<div class="navbar navbar-fixed-top">
</div>

<section id="main">

</section>
like image 794
adit Avatar asked Oct 06 '13 02:10

adit


2 Answers

The fixed navbar will overlay your other content, unless you add padding to the top of the <body>. Try out your own values or use our snippet below. Tip: By default, the navbar is 50px high.

body { padding-top: 70px; }

Make sure to include this after the core Bootstrap CSS.

ref: http://getbootstrap.com/components/#navbar-fixed-top

I dont know why they dont put this note in bootstrap 2.3.2 but this is what you want. :)

like image 180
Chokchai Avatar answered Nov 15 '22 22:11

Chokchai


Yesterday I fix my navbar and set the container as following

.maincontainer{ padding-top: 75px; }

75 pixel is enough and doesn't affect Bootstrap on Responsive design in Tablet and Mobile. Work perfect everywhere :)

like image 2
Anirudha Gupta Avatar answered Nov 15 '22 22:11

Anirudha Gupta