Looking to add animation to a title that consists of two parts: "HARD" and "WARE", with the second part having a more transparent color.
When hovering over the "HARD" word, the colors reverse correctly. However, when hovering over the "WARE" word, only one color changes. I've attempted to use combinators selectors, but there isn't a selector for "previous siblings".
body {
background-color: #171717;
}
#title {
font-size: 10vmax;
font-family: 'Open Sans', Calibri;
}
#hard {
color: rgba(255, 255, 255, 1);
transition: all 0.3s ease-in-out;
}
#hard:hover {
color: rgba(255, 255, 255, 0.18);
}
#hard:hover + #ware {
color: rgba(255, 255, 255, 1);
}
#ware {
color: rgba(255, 255, 255, 0.18);
transition: all 0.3s ease-in-out;
}
#ware:hover {
color: rgba(255, 255, 255, 1);
}
#title span:last-child:hover + #title > span:first-child {
color: rgba(255, 255, 255, 0.18);
}
<div id="title">
<span id="hard">HARD</span>
<span id="ware">WARE</span>
</div>