Is it possible to use Twitter Bootstraps .navbar-fix-to-top only on mobile devices?
css, html, twitter-bootstrap
Solution
you can use a media query for that, something like this:
@media screen and (max-width: 480px)
{
nav.navbar
{
margin: auto; /*or the margin that you need*/
}
}
Problem
I have Twitter Bootstrap 3 webpage with this navbar: ``` <div class="col-xs-12 col-md-10 col-md-offset-1"> <nav class="navbar navbar-inverse" role="navigation"> <div class="navbar-header"> <button class="navbar-toggle" type="button" data-toggle="collapse" data-target=".navbar-ex1-collapse"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="#" class="navbar-brand"> Title </a> </div> <div class="collapse navbar-collapse navbar-ex1-collapse"> ... </div> </nav> </div> ``` It looks good on desktop with some top margin. But is it possible to use the .navbar-fixed-to-top only on mobile devices? So that on a mobile device the navbar is always on top without top, left and right margin?