How do I remove background-image in css?

Viewed 360003

I have a general rule which gives all DIVs a background image.
I have one div (with id='a') which I don't want it to have the background image.
What css rule do I have to give it?

11 Answers

When background-image: none !important; have no effect. You can use:

background-size: 0 !important;

HTML :

<div id="a" class="mydiv"></div>    

CSS:

div#a {
       background-image:none;
}

Another Way:

div:not(#a) {
     //all rules goes here 
     //add image here
     //div with id a not effected by these rules
   }

Multiple (not pseudo)

   div:not(#a):not(#b):not(#c) {
     //all rules goes here 
     //add image here
     //div with ids not effected with these rules
   }
Related