Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Bootstrap - navbar-fixed-top covers content

Tags:

I have a question about navbar-fixed-top. Well, I have a simple problem with it. My fixed navbar covers content, for example in "About us" page, it covers row with "About us" title.

I have no idea how can I fix it, because when I resize website (mobile devices size) the header is visible.

Of course I have this kind of problem with headers in other pages (Full Width and 404).

Also, in Index page, it covers some of carousel slider.

Information:

  • website: http://testerix.site90.com/index.html

  • bootstrap 2.3.2

Let me know, how can I fix it on all resolutions.

like image 275
testerius Avatar asked Nov 02 '13 10:11

testerius


People also ask

How do I create a fixed navigation bar in bootstrap?

Set the navbar fixed to the top, add class . navbar-fixed-top to the . navbar class.

How do I make navbar stay on top in bootstrap 4?

Use the .sticky-top class to make the navbar fixed/stay at the top of the page when you scroll past it.

How do I keep the navbar always on top?

To create a fixed top menu, use position:fixed and top:0 . Note that the fixed menu will overlay your other content. To fix this, add a margin-top (to the content) that is equal or larger than the height of your menu.

What is navbar fixed top?

A fixed navigation bar, also referred to as a “sticky” navigation bar, is a toolbar that stays in place while the user is scrolling the web page.


2 Answers

the response is in the page:

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

Add to your CSS:

body { 
    padding-top: 65px; 
}

or a more complex solution but responsive, if your navbar change the height( ex in tablets appears in more to 60px; or is different ) use a mixed solution with css and javascript

CSS:

    #godown{
   height: 60px;
}

HTML (resumen)

<body>
<nav class="navbar navbar-fixed-top " role="navigation" id="navMenu">
...

</nav>

<!-- This div make the magic :) -->

<div class="godown-60" id="godown"></div>

<!-- the rest of your site -->
...

JAVASCRIPT:

<script>
//insert this in your jquery
//control the resizing of menu and go down the content in the correct position

    $("#navMenu").resize(function () {
        $('#godown').height($("#navMenu").height() + 10);
    });

    if ($("#navMenu").height() > $('#godown').height()) $('#godown').height($("#navMenu").height() + 10);

</script>
like image 165
chefjuanpi Avatar answered Sep 25 '22 08:09

chefjuanpi


Try class="navbar-static-top". It still allows navigation bar to be stay on the top but doesn't block content.

like image 44
Antonio Jha Avatar answered Sep 25 '22 08:09

Antonio Jha