html - 导航栏不会在正确的断点处折叠

标签 html css twitter-bootstrap navbar

在一个正在处理的站点上,我用一个像素更改了断点。当你打开this page在768像素宽的窗口中,topmenu并没有消失,应该出现的菜单按钮也没有出现。

当宽度更改为 767 像素时,一切正常。

我不知道我在这里错过了什么。

最佳答案

您可以尝试更改@grid-float-breakpointrecompiling

来自navbar docs :

Changing the collapsed mobile navbar breakpoint

The navbar collapses into its vertical mobile view when the viewport is narrower than @grid-float-breakpoint, and expands into its horizontal non-mobile view when the viewport is at least @grid-float-breakpoint in width. Adjust this variable in the Less source to control when the navbar collapses/expands. The default value is 768px (the smallest "small" or "tablet" screen).


或者,如果你不想重新编译,取Skelly's code :

@media (max-width: <b>767px</b>) {
    .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;
    }
}

Working Demo in jsFiddle

关于html - 导航栏不会在正确的断点处折叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25088365/

相关文章:

html - Bootstrap 'col' 标签不会将文章拉入尽可能多的行

html - 为 .each 循环中的一个条目显示带有表显示值的模态

jquery - 如何隐藏 Bootstrap slider 和所有图像应垂直显示在移动设备上?

javascript - 在调整窗口大小时将 div 更改为相同位置

jquery - href 链接上的数据描述使用

jquery - Bootstrap 侧边栏贴在滚动条上闪烁

css - 文本未使用 flexbox 居中

javascript - 如何使用 jQuery 操作 &lt;script&gt; 标签?是否可以?

jQuery:每个单选按钮每个addClass到一个div

html - <Span> 不是 block 文本