I have the following html structure:
<div class="menu">
<div class="menu-item">WORK</div>
<div class="menu-item">HOME</div>
<div class="menu-item">CONTACT</div>
</div>
and this css
.menu {
position: absolute;
display: flex;
justify-content: center;
align-items: center;
}
.menu-item {
position: absolute;
color: #fff;
font-size: 128px;
user-select: none;
transition: 200ms ease-in-out;
filter: drop-shadow(100px 100px 0 rgba(0,0,0,0.7)) drop-shadow(0px 0px 10px rgba(0,0,0,0.5));
}
.menu-item:hover {
transform: scale(0.9);
filter: drop-shadow(0px 0px 0 rgba(0,0,0,0.3)) drop-shadow(0px 0px 10px rgba(0,0,0,0.5));
}
.menu-item:first-child{
color: rgba(255,255,255,0.5);
transform: translate(-200px, -200px);
}
.menu-item:first-child:hover{
color: rgba(255,255,255,1);
transform: translate(-200px, -200px) scale(0.9);
}
.menu-item:last-child{
color: rgba(255,255,255,0.5);
transform: translate(200px, 200px);
}
.menu-item:last-child:hover{
color: rgba(255,255,255,1);
transform: translate(200px, 200px) scale(0.9);
}
.menu-item:hover ~ .menu-item:first-child {
color: rgba(255,255,255,0);
}
The last part is where my problem is. The ~ doesn't seem to affect the first child at all. I also tried space and + but it didn't work either. Any help would be appreciated. Thanks.