I'm unable to inject a style with an “!important” rule

前端 未结 7 1510
星月不相逢
星月不相逢 2020-12-05 04:19

I tried to inject a style using this code:

document.body.style.color=\'green!important\';

Per the CSS cascade ref, by applying the !i

7条回答
  •  春和景丽
    2020-12-05 04:37

    style.cssText is the only way to add !important.

    
    

提交回复
热议问题