如果存在使用!important
的CSS規則,是否有辦法刪除!important
規則,以便我可以使用JS或jQuery進行更進一步的下游樣式更改?我可以使用jquery刪除/否定css!重要規則嗎?
theirs.css
div.stubborn { display: none !important; }
mine.js
$('.stubborn').fadeIn(); // won't work because of !important flag
不幸的是,我沒有在應用!important
規則的風格控制,所以我需要一個解決。
+1可悲的是,這是一個黑客之一的類型需要使用時,有在」重要的一個工作,爆炸「工廠 – 2012-08-09 19:57:45
一些很好的閱讀http://stackoverflow.com/questions/3706819/what-are-the-implications-of-using-important-in-css http://coding.smashingmagazine.com/2010/11/02/the-important-css-declaration-how-and-when-to-use-it/ – 2012-08-09 20:03:50
+1 I second _inline_ approach,尤其是在我使用jQuery Mobile的情況下。 – Omar 2013-04-09 16:49:45