I want to define css that does apply to .b
but not to .a .b
No hacks accepted in the manner of
.a .b {
background-color: cornflowerblue;
}
Furthermore, the html can be in a arbitrary container. body > .b
is as well not working for my case
I want to use the :not
selector or an alternative solution that does not make me change the definition of .a .b
div {
width: 50px;
height: 50px;
background-color: cornflowerblue;
margin: 10px;
border: 1px solid salmon;
}
.b {
background-color: green;
}
<div class="a">
<div class="b"></div>
</div>
<div class="b"></div>
see codepen here