I have below HTML and I want to hide all divs having class 'msg' excluding one div having same class.
<html>
<div class="ref" >
<div class="msg"> Message ref </div>
</div>
<div class="msg"> Message 1 </div>
<div class="msg"> Message 2 </div>
<div class="msg"> Message 3 </div>
</html>
Here I want to hide all div having class 'msg' except div which is inside another div having class 'ref' using css only.
My style for that is
.msg:not(.ref.msg) {
display: none;
}
But it is not working.Please suggest me some required tweaks to my CSS style to achieve result.
Thanks.
:notonly accepts simple selectors.