[英]How to overwrite the linked scss of a CSS file
I would like to create a navbar fixed on the bottom on mobile but on the left on desktop.我想创建一个固定在移动设备底部但在桌面左侧的导航栏。
I've inspected the CSS, and the linked scss of the CSS file is overwriting my CSS in the media query.我检查了 CSS,CSS 文件的链接 scss 覆盖了媒体查询中的 CSS。
I've found this post why my css is overriden by scss which is even not included but I can't use a more specific selector.我找到了这篇文章, 为什么我的 css 被 scss 覆盖,这甚至不包括在内,但我不能使用更具体的选择器。
What could I do ?我能做什么 ? Note the property have got
!important
and the menu is <aside>
注意属性有
!important
并且菜单是<aside>
Screenshots:截图:
In red : the property that I want to override the scss红色:我想覆盖 scss 的属性
In yellow : the property of scss which I want to override (it works when disabling it on the inspector)黄色:我想覆盖的 scss 属性(在检查器上禁用它时有效)
You may also set top
to auto
to make sure bottom
is more important than top:0
您也可以将
top
设置为auto
以确保bottom
比top:0
更重要top:0
.menu {
top: auto ;
bottom : 0 ;
}
remove !important
from media queries.从媒体查询中删除
!important
。 This is not a good practice, after that this will work.这不是一个好的做法,之后这将起作用。 If you can't then add
!important
in .menu
as well.如果你不能,那么在
.menu
添加!important
。
You can give your .menu
items an additional class你可以给你的
.menu
项目一个额外的类
.menu.bottomed {
bottom: 0px;
}
There's always a way to have a more specific selector, unless it's a selector by id.总有一种方法可以有一个更具体的选择器,除非它是一个 id 选择器。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.