this is structure of html
<div class="parent">
<div class="child1" style="background: red;"></div>
<div class="child2" style="background: blue;"></div>
</div>
i want to make border-color
of .parent
element red when i hover
over .child1
and blue when i hover
over .child2
using only CSS.
is it possible.
i am new to web, so i ask on chatGPT. it produce some garbage code that didn't work.
.parent:hover {
border-color: red;
}
.child1:hover ~ .parent {
border-color: blue;
}
.child2:hover ~ .parent {
border-color: green;
}