简体   繁体   English

“ @media only屏幕和()” css不覆盖

[英]“@media only screen and ()” css not overwriting

被检查的CSS

It's an SVG (in img tag) thats held inside a div, for some reason the @media only screen and () CSS wont overwrite the previous CSS rules. 这是一个div内保存的SVG(在img标签中),出于某种原因, @media only screen and () CSS不会覆盖以前的CSS规则。 And i have no clue why this is, could someone please explain/give a solution? 而且我不知道为什么会这样,有人可以解释/给出解决方案吗?

Your @media query is above the style you're trying to overwrite. 您的@media查询高于您要覆盖的样式。

In CSS, if it's defined multiple times, the later/more specific one wins. 在CSS中,如果多次定义,则以较晚/更具体的一个为准。

Your screenshot also shows the lines of the stylesheet in which these rules are written: The regular rule is in line 131, the media query rule in line 63. According to this the regular rule is after/below the media query, so it overwrites the media query, since it applies to everything. 屏幕快照还显示了编写这些规则的样式表的各行:常规规则在131行,媒体查询规则在63行。根据此规则,常规规则在媒体查询之后/下方 ,因此它覆盖了媒体查询,因为它适用于所有内容。 Just change the order in your stylesheet. 只需更改样式表中的顺序即可。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM