Hide navbar in mobile browsers

邮差的信 提交于 2019-12-07 19:56:56

问题


I'm making a mobile responsive site using Twitter Bootstrap. I'd like to completely hide the top navbar when the site is viewed on mobile. Anyone know a way to do this?


回答1:


The easiest way is to use the responsive utility classes .hidden-phone and .hidden-tablet

<div class="navbar hidden-tablet hidden-phone">

You could also use a media query such as..

@media (max-width: 767px) { 
    .navbar{
        display:none;
    }
}

More on responsive classes here: http://twitter.github.io/bootstrap/scaffolding.html#responsive

Demo




回答2:


Bootstrap 3 has just .hidden-xs/sm/md/lg

Phone/tablet/desktop apply for BS2.x only




回答3:


Try this!
just add "hidden-xs" to the div class

<div class="navbar hidden-xs">


来源:https://stackoverflow.com/questions/16655538/hide-navbar-in-mobile-browsers

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!