twitter-bootstrap 在移动浏览器中隐藏导航栏

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/16655538/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-21 17:10:00  来源:igfitidea点击:

Hide navbar in mobile browsers

twitter-bootstrapuinavigationbar

提问by Sara

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?

我正在使用 Twitter Bootstrap 制作一个移动响应式网站。当在移动设备上查看网站时,我想完全隐藏顶部导航栏。有人知道这样做的方法吗?

回答by Zim

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

最简单的方法是使用响应式实用程序类.hidden-phone.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

更多关于这里的响应类:http: //twitter.github.io/bootstrap/scaffolding.html#responsive

Demo

演示

回答by zzzzzzz

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

Bootstrap 3刚刚.hidden-xs/sm/md/lg

Phone/tablet/desktop apply for BS2.x only

手机/平板电脑/台式机仅适用于 BS2.x

回答by uriateho

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

试试这个!
只需将“hidden-xs”添加到 div 类

<div class="navbar hidden-xs">