It is necessary to change the style of six when hovering over three (by CSS)
body { width: 200px; height: 200px; display: flex; justify-content: space-between; } .three { width: 20px; height: 20px; background-color: blue; } .six { width: 20px; height: 20px; background-color: yellow; } <div class="one"> <div class="two"> <div class="three"> </div> </div> </div> <div class="four"> <div class="five"> <div class="six"> </div> </div> </div> Google and found nothing sensible