I have a class assigned to the first div within a div with class “level”. Works fine.
I need to swap the style if the parent div has an id=”selected”. Having difficulty selecting it…
.level:first-child div:nth-child(1) {
background-position: 0px -368px;
}
.level:first-child div:nth-child(1) #selected {
background-position: 0px -429px;
background-color:red
}
<div class="level" id="selected">
<div></div>
<div></div>
</div>
Put the
idin front