Reputation: 91
Is it possible in CSS that when for example the class 'demo1' is display:block
the class 'demo2' is automatically display:None
Upvotes: 2
Views: 2653
Reputation: 157314
Short Answer : No
Workaround : Use Javascript or jQuery using .toggle()
If you want to stick with CSS, you can do something like
div[style*="block"] + div {
display: none;
}
The above selector will see whether div
having an attribute of style
contains a value called block
if yes, than hide the adjacent
div
element using +
Upvotes: 3