Having some difficulty with changing the background color of a div when text is hovered over.
The setup involves using absolute positioning for the div.book element, and the text is positioned absolutely on top of it with the text having a higher z-index (3) than the div (2).
When hovering over the div, the entire background changes. However, most of the div is covered by the text, so no change is visible. Attempted solution:
h1:hover + div.book {
background-color: rgba(333, 33, 33, 1);
}
.book {
height: 50px;
}
<h1>Book</h1>
<div class="book"></div>
Unfortunately, unable to make it work. Any suggestions?
Thanks for your help!