Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Placing banner above the Bootstrap 3 navbar?

I have this Bootstrap 3 navbar: http://www.bootply.com/xkcDjvQslb

I want the following modifications:

  1. Add banner above the fixed navbar
  2. Hide the banner when I scroll down

I saw the following example: http://www.bootply.com/69848; not great at bootstrap and when I pull the relevant code it breaks my menu.

The banner (above the navbar) would be a table with a logo on the left side and title on the right. I need someone to point me in the right direction?

like image 918
Chaka Avatar asked Nov 30 '14 02:11

Chaka


People also ask

How do I create a top bar in Bootstrap?

To create a collapsible navigation bar, use a button with class="navbar-toggler", data-toggle="collapse" and data-target="#thetarget" . Then wrap the navbar content (links, etc) inside a div element with class="collapse navbar-collapse" , followed by an id that matches the data-target of the button: "thetarget".

What is navbar header in Bootstrap?

The navbar-header is mostly an architectural class for Bootstrap navbar. It allocates approximately 150px to the left of the navbar to wrap the navbar-brand and allow the brand name or logo to make use of the entire area on click or hover.

What is the difference between NAV and navbar in Bootstrap?

A "navbar" is an area on a page that contains navigation components (links, buttons, etc) for getting to other pages of the website. A "nav" is an HTML element that is normally used to enclose other elements related to navigation.


2 Answers

Remove navbar-fixed class in nav. Then place markup above the nav.

http://www.bootply.com/vxJEiv1RC2

like image 161
Rafael Avatar answered Oct 18 '22 19:10

Rafael


I found the solution here: http://jsfiddle.net/DTcHh/541/ , just needed to clean up my code:

topnavbar {
    margin: 0;
}
#topnavbar.affix {
    position: fixed;
    top: 0;
    width: 100%;
}

#banner {
     background-color: yellow;   
}
like image 3
Chaka Avatar answered Oct 18 '22 18:10

Chaka