Search code examples
cssstylish

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;
}

Solution

  • 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