Reputation: 38150
Is the browser able to optimize longer :not
chains or would that cause negative performance impacts?
Simplified example:
.animal:not(.cow):not(.dog):not(.cat):not(.bird):not(.unicorn):not(.tiger) {
display: none !important
}
The idea behind is that I want to hide those animals but
cow
might have display:table
, tiger
might have display:flex
and .unicorn
might even have display: none
Upvotes: 5
Views: 3227
Reputation: 3787
According to the books and other writings I read about CSS, it does not seem a problem. This is an excellent book (Scalable and Modular Architecture for CSS - Jonathan Snook) extract about Selector Performance.
Upvotes: 5