CSS 更改默认响应式导航栏断点

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12486051/
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-08-29 20:12:07  来源:igfitidea点击:

Change the default responsive navbar breakpoint

csstwitter-bootstrap

提问by Dee

is there a way to change the breakpoint where Bootstrap menu becomes responsive and collapse? 979px is far too big for me and I would like the transformation taking place only on smaller sizes.

有没有办法更改 Bootstrap 菜单变得响应和折叠的断点?979px 对我来说太大了,我希望只在较小的尺寸上进行转换。

回答by Nick Kugaevsky

Yes, you can do it by redefining @navbarCollapseWidthvariable in less/variables.lessfile. And recompiling css after that.

是的,您可以通过重新定义文件中的@navbarCollapseWidth变量来实现less/variables.less。然后重新编译css。

Compiling instructions can be found in Compiling Bootstrap with Lesssection of official documentation.

编译说明可以在官方文档的使用 Less部分编译 Bootstrap 中找到。

回答by Michael Trouw

@nick-kugaevsky the 'compiling bootstrap with less' - link is broken.

@nick-kugaevsky '用更少的编译引导程序' - 链接已损坏。

BTW, for bootstrap 3 RC 1, you will want to modify the following property in less/variables.less

顺便说一句,对于 bootstrap 3 RC 1,您需要修改以下属性 less/variables.less

// Point at which the navbar stops collapsing
@grid-float-breakpoint:     @screen-phone;      // here i allready changed it

BTW: this only prohibits the responsive nav to collapse when width > @screen-phone for example. Here is some more info on compiling bootstrap with less: http://bootstrap.lesscss.ru/less.html

顺便说一句:例如,这只会在宽度 > @screen-phone 时禁止响应式导航折叠。以下是有关使用 less 编译引导程序的更多信息:http: //bootstrap.lesscss.ru/less.html

You have to download bootstrap, point your app or the node js util to the bootstrap directory containing the less files, modify less/variables and recompile the bootstrap.less file.

您必须下载 bootstrap,将您的应用程序或 node js util 指向包含 less 文件的 bootstrap 目录,修改 less/variables 并重新编译 bootstrap.less 文件。

Argh, just found out it this is written in the bootstrap documentation: http://getbootstrap.com/components/#navbar

啊,刚刚发现它写在引导程序文档中:http: //getbootstrap.com/components/#navbar