Darakath Darakath -3 years ago 136
CSS Question

How to override CSS Background that already has !important?

I am trying to override a website's background with Stylish but it isn't working.
The background css for the website also has an !important, and it is overriding Stylish.

My code:

body {
background-image: none !important;
background: black !important;
}


Any help?

Answer Source

You'll need to be more specific (quick guide to CSS specificity), for instance, using the > selector:

body {
  background-image: none !important; 
  background: black !important;
}

html > body {
  background-image: none !important; 
  background: red !important;
}

JSBin

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download