Hello there! I have a question about applying styles to specific classes when hovering over certain elements. Unfortunately, I am unable to make changes to the HTML files and can only work with the CSS file. Take a look at the image below for reference: https://i.stack.imgur.com/fq3pm.png https://i.stack.imgur.com/xvtZm.png https://i.stack.imgur.com/ufyv0.png
body {
margin: 0;
}
#container {
position: relative;
background-color: #d5d8dc;
margin-top: 100px;
margin-left: 100px;
width: 400px;
height: 400px;
}
.right {
background-color: #2ecc71;
position: absolute;
width: 320px;
height: 40px;
}
.right:nth-child(1) {
left: 20%;
}
.right:nth-child(2) {
transform: rotate(90deg);
right: -140px;
top: 140px;
}
.right:nth-child(3) {
left: 20%;
bottom: 20%;
}
.right:nth-child(4) {
transform: rotate(90deg);
right: +140px;
top: 140px;
z-index: 2;
}
.left {
background-color: #e74c3c;
position: absolute;
width: 320px;
height: 40px;
}
.left:nth-child(5) {
left: 0;
top: 20%;
}
.left:nth-child(6) {
transform: rotate(90deg);
right: -60px;
top: 220px;
}
.left:nth-child(7) {
left: 0;
bottom: 0;
}
.left:nth-child(8) {
transform: rotate(90deg);
left: -140px;
top: 220px;
}
.left:hover {
z-index: 3;
}
.right:hover {
z-index: 3;
}
<div id="container">
<div class="right"></div>
<div class="right"></div>
<div class="right"></div>
<div class="right"></div>
<div class="left"></div>
<div class="left"></div>
<div class="left"></div>
<div class="left"></div>
</div>