dansayag
dansayag

Reputation: 77

correct syntax in :not() css

I'm using the current code

#extra-sidebar , .entry-content:not(#post-262){
background-color: rgba(255,255,255,0.8);
}

It actually affects my #extra-sidebar but also my .entry-content entirely. I would like to make an exception for the #post-262 which is affected by the entry-content

Thank you

Upvotes: 0

Views: 77

Answers (3)

dansayag
dansayag

Reputation: 77

Well the way was to use

#post-262 { 
  background-color:#previousvalue!important;
}

No need to use :not() function, !important is enough to set priorities.

Upvotes: 0

David Dayag
David Dayag

Reputation: 1340

IE8 and earlier do not support the :not selector.

It's best to just override the class with another class like so:

#extra-sidebar, .entry-content{
   background-color: rgba(255,255,255,0.8);
}

.entry-content #post-262{
   background: none;
}

Upvotes: 2

Niet the Dark Absol
Niet the Dark Absol

Reputation: 324600

Would I be correct in guessing that #post-262 is actually a child of an .entry-content element (or the other way around), and that they are not one and the same?

If so, you will need to define a style for #post-262 that overrides the background colour to the same as whatever's behind the container.

Upvotes: 0

Related Questions