覆盖通过JS通过CSS添加的内联样式 [英] Override Inline Styles added via JS with CSS

查看:233
本文介绍了覆盖通过JS通过CSS添加的内联样式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

js插件添加了一种让我头痛的样式:

A js plugin is adding a style that is giving me some headache:

element.style {
     z-index: 100 !important;
}

所以我试过这个:

html body div#shell div#shellContent div#bottomPart div#rightCol div.containerBox    
div#embedContainer div#janrainEngageEmbed div.janrainContent div#janrainView   
div.janrainHeader[style] {
    z-index: 1 !important;
}

,但仍然没有。

推荐答案

与其他答案相反,可以使用CSS覆盖内联样式:

Contrary to the other answers, it is possible to override inline styles with CSS:

http://css-tricks.com/override-inline-styles-with-css/

我猜想极长的选择器可能不会击中元素。

I would guess that the extremely long selector might not be hitting the element.

我有一个类似的z-index问题由此解决的Janrain插件:

I had a similar z-index issue with the Janrain plugin that was solved by this:

#janrainEngageEmbed > div[style] {
    z-index: 0;
}

在您的情况下,您可能需要:

In your case, you probably need:

    z-index: 0 !important;

这篇关于覆盖通过JS通过CSS添加的内联样式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆