放置在单独的文件中时,覆盖Bootstrap媒体查询不起作用。(Overriding Bootstrap media query does not work when placed in separa

编程入门 行业动态 更新时间:2024-10-25 14:22:26
放置在单独的文件中时,覆盖Bootstrap媒体查询不起作用。(Overriding Bootstrap media query does not work when placed in separate file. Why?)

以下引导程序媒体查询将断点更改为992px(从768px),以便引导程序的默认导航栏崩溃。

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

当我将上面的内容放在一个单独的文件中并将其链接到bootstrap.css下面的HTML中时,规则不会生效,但是如果我将它直接放在bootstrap.css (最后),那么它就可以了。

anybuddy可以告诉我为什么当我把它放在另一个文件并链接到html时它不适用?

The following bootstrap media queries changes the break-point to 992px (from 768px) for the bootstrap's default navbar's collapse.

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

When I put the above in a separate file and link it in the HTML below bootstrap.css, the rule does not take effect however if I place it directly in bootstrap.css (at the end) then it works.

Can anybuddy tell me why it doesn't get applied when I put it in another file and linked to html ?

最满意答案

当我将上面的内容放在一个单独的文件中并将其链接到bootstrap.css下面的HTML中时,规则不会生效,但是如果我将它直接放在bootstrap.css (最后),那么它就可以了。

检查<link rel="stylesheet" type="text/css" href="path/custom.css"> 。 这可能是错的。

When I put the above in a separate file and link it in the HTML below bootstrap.css, the rule does not take effect however if I place it directly in bootstrap.css (at the end) then it works.

Check the path of your <link rel="stylesheet" type="text/css" href="path/custom.css">. It's probably wrong.

更多推荐

本文发布于:2023-04-29 07:34:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1335880.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:中时   不起作用   文件   媒体   Bootstrap

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!