css :not to enable or disable based on presence of class

css :not() pseduo selector is supported in IE9 and up as well as latest other browsers

you can use it to style things depending on the presence/absence of other classes
e.g. here if body does NOT have a class "show-summary" then hide the summary section

body:not(.show-summary) {
    .summary {
       display: none;
    }
}

...otherwise if .show-summary is present then show it
body.show-summary {
    .summary {
       display: block;
    }
}

powerful

Comments

Popular posts from this blog

deep dive into Material UI TextField built by mui

angular js protractor e2e cheatsheet

react-router v6.4+ loaders, actions, forms and more