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
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
Post a Comment