Bootstrap 3 - 为所有屏幕尺寸显示折叠导航 [英] Bootstrap 3 - show collapsed navigation for all screen sizes

查看:469
本文介绍了Bootstrap 3 - 为所有屏幕尺寸显示折叠导航的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Bootstrap v3。

I am using Bootstrap v3.

我有navbar类,所以当我有我的屏幕手机大小的导航崩溃和小网格切换按钮出现 - 所以这是按预期工作。

I have the navbar classes in place so that when I have my screen mobile-size the navigation collapses and the little grid-like toggle button appears - so this is working as expected.

我想要的是,这是所有屏幕尺寸的默认操作。也就是说,即使在桌面上,我想导航被折叠,切换按钮也是可见的。

what i would like, is for this to be the default action for all screen sizes. That is, even on a desktop I would like the navigation to be collapsed and the toggle button to be visible.

我已经看过css,

我已经尝试过注释较大的媒体查询,虽然有很多的东西,提供了功能,虽然我不知道哪些部分。

I've tried commenting out the larger media-queries, though there are a lot of them and it seems to have a knock-on effect to other styling.

任何想法?

推荐答案

您可以使用覆盖默认的Bootstrap CSS像这样...

You can use override the default Bootstrap CSS like this...

    .navbar-header {
        float: none;
    }
    .navbar-toggle {
        display: block;
    }
    .navbar-collapse {
        border-top: 1px solid transparent;
        box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
    }
    .navbar-collapse.collapse {
        display: none!important;
    }
    .navbar-nav {
        float: none!important;
        margin: 7.5px -15px;
    }
    .navbar-nav>li {
        float: none;
    }
    .navbar-nav>li>a {
        padding-top: 10px;
        padding-bottom: 10px;
    }

演示:http://www.bootply.com/114896

这将确保通过覆盖Bootstrap @media始终使用折叠的导航栏查询。

This will ensure that the collapsed navbar is always used by overriding the Bootstrap @media queries.

这篇关于Bootstrap 3 - 为所有屏幕尺寸显示折叠导航的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆