How to exclude an element (via ID) in CSS

I have a CSS rule, for example * {-webkit-transition:all 0.7s ease} . This applies to all elements on the page, but I want to exclude an element from this rule with the classic identifier, how can I do this?

+6
source share
1 answer

CSS 3 pseudo-class to exclude elements :not . To exclude all elements matching #classic , but keep the rest, use

 * :not(#classic) { /* your definitions here */ } 

See the W3C specification for selectors . Please note that these CSS3 selectors do not work in all browsers, especially older versions of Internet Explorer will happily ignore them.

+21
source

Source: https://habr.com/ru/post/923733/


All Articles