How to override CSS style without entering a new value?

I want to override the style that is in the stylesheet on another server. However, I do not want to introduce new values, I just want to somehow cancel this style. Is it possible? The rival style overestimates some of my other styles, and I just want to basically filter out the remote style.

+3
source share
4 answers

You can not.

Cascade styles and returns are not refundable. Even the default value is only the value assigned to it in the browser’s internal stylesheet.

If you want to override something, you must do it explicitly.

+2
source

, , . ?

+1

, :
, , ( ), , :

div#container div#navBar ul.navLinks li.link
{
    color:#000;
}

- :

li.link

"! important" - , :

color:#000!important;

,

+1

javascript:

// in the following, replace 1 with the index of the
// stylesheet you want to disable
var ss = document.styleSheets[1];
var rls = ss.cssRules ? ss.cssRules : ss.rules;
for(var i = 0; i < rls.length; i++){
    ss.deleteRule(i);
}

- css hell

0

Source: https://habr.com/ru/post/1750585/


All Articles