Answers for "css selector if another class exists"

CSS
1

apply css if class not present

.container:not(.container2) > .myDiv {
  color: red;
}
Posted by: Guest on August-31-2021
0

check if element with class has another class javascript

const div = document.querySelector('div');
div.classList.contains('secondary'); // trueCode language: JavaScript (javascript)
Posted by: Guest on March-02-2021

Browse Popular Code Answers by Language