I am trying to change the color of box2 when I hover over box1 but its not working. please help me why this is not working.
body {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
}
.box1,
.box2 {
width: 100px;
height: 100px;
}
.box1 {
background-color: teal;
/* position:relative; */
}
.box2 {
background-color: tomato;
position: relative;
left: -50px;
}
.box1:hover .box2 {
background-color: green;
}
<div class="box1"></div>
<div class="box2"></div>