Reputation: 1155
I want to override a style that's in a stylesheet on another server. However, I don't want to enter new values, I just want to cancel out that style somehow. Is that possible? The competing style is overriding some of my other styles and I just want to basically filter the remote style out.
Upvotes: 4
Views: 1463
Reputation: 298898
you could do it in 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);
}
but read about cross browser css hell first
Upvotes: 0
Reputation: 682
I'd say you can do a couple things:
First you can define your selector as specific as possible, which means that if you are styling an element inside a table (or within any other element), make sure your selector includes the parent elements, as an example:
div#container div#navBar ul.navLinks li.link
{
color:#000;
}
This will have precedence over something like:
li.link
or you can just add "!important" to the value and that will definitively override anything else, like this:
color:#000!important;
Hope it helps
Upvotes: 1
Reputation: 943579
You can't.
Stylesheets cascade and there is no going back. Even the default value is just the value assigned to it in an internal browser stylesheet.
If you want to override something, you have to do so explicitly.
Upvotes: 2
Reputation: 203
You can try setting it to auto or inherit and it might behave how you want. What is the property you are trying to change?
Upvotes: 1