简体   繁体   English

加载时禁用CSS样式(开发人员工具)

[英]CSS styles disabled on load (developer tools)

I have a set of styles that are not being applied. 我有一组未应用的样式。 I am used to overridden styles being crossed out but my styles are showing as if I had disabled them on page load and the styles are not applied on any device. 我习惯于覆盖被划掉的样式,但我的样式显示好像我在页面加载时禁用了它们,并且样式不适用于任何设备。 I also can enable them in the firefox dev tools and they work fine. 我也可以在firefox开发工具中启用它们,它们工作正常。

开发工具的屏幕截图 - 我自己没有禁用这些样式

I have a load of JS going on around this area so I'm willing to accept that is why, but I'm not able to trace it any further without understanding what is happening. 我有一大堆JS围绕这个区域进行,所以我愿意接受这就是为什么,但是如果不了解正在发生的事情,我无法进一步追踪它。 I'm looking to get all three disabled styles working ( margin-bottom , box-shadow & border-radius ). 我希望所有三种禁用的样式都能正常工作( margin-bottombox-shadowborder-radius )。

Of course any help figuring out the whole problem would be appreciated, but primarily I'd like to understand what the behaviour that the dev tools is giving me means. 当然,任何帮助搞清楚整个问题都会受到赞赏,但主要是我想了解开发工具给我的行为意味着什么。

If it really helps I'll share the site address. 如果它真的有帮助我会分享网站地址。

If you refer to the width: 200px attribute being crossed out, the explanation is quite simple: Inline style attributes will always override CSS attributes. 如果您引用width: 200px属性被划掉,则解释非常简单: 内联样式属性将始终覆盖CSS属性。

The CSS properties you see under element{} at the right are those applied by your style attribute (embedded in your HTML or set by Javascript). 您在右侧element{}下看到的CSS属性是由您的style属性(嵌入在HTML中或由Javascript设置)应用的属性。 Unless you remove the width from the style attribute, your CSS width will never be applied. 除非从style属性中删除width ,否则将永远不会应用CSS width

Even if you were overriding the styles inline (hard coded or with script), the corresponding style sheet property would have a line through it. 即使您重写内联样式(硬编码或使用脚本),相应的样式表属性也会有一行。 In FireBug, assuming that's what that is, the circle with the line means you manually disabled them. 在FireBug中,假设是这样,带有线的圆圈表示您手动禁用它们。

This may be too obvious, but I have to ask, is this an SPA? 这可能太明显了,但我不得不问,这是SPA吗? Have you performed a hard refresh? 你进行了硬刷新吗? have you turned off FireBug, cleared cache and tried again? 你有没有关闭FireBug,清除缓存并再次尝试?

Firebug / Firefox开发工具显示被注释为禁用的css行,并允许您将它们视为已禁用它们。

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

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