0

I am wondering what would be best practice in this situation. I have a navbar in a twitter bootstrap page and there is content above the page when viewed on a desktop. The navbar collapses when the screen width is low enough, but after the collapse the navbar is in the same position but I want it to be at the top of the page after collapse. What would be the best way to do this?

Here is my demo: http://www.bootply.com/61283

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624
guru
  • 197
  • 2
  • 16

1 Answers1

0

Assuming you're using the standard Bootstrap nav-collapse for the navbar, you could use the 'visible-desktop' for the desktop-only content:

<div class="container visible-desktop">Desktop only content above nav..</div>

On smaller screens this will not show, and as a result the navbar will display at the top.

Demo 1

EDIT (alternative):

An alternative method would be to use @media queries and change the CSS to position elements on the smaller screens..

@media (max-width: 767px) { 
    .navbar{
        position:absolute;
        top:0;
    }
    #topContent{
        margin-top:45px;
    }
}

Demo 2

Carol Skelly
  • 351,302
  • 90
  • 710
  • 624