I need assistance with changing the child element when the parent is hovered over. I also want to modify an attribute of the parent at the same time. Specifically, I want the background color of #action
to change and also adjust the color of the a
or h1
elements upon hovering over the action
. Is this achievable?
Below is the HTML code snippet:
<section id="action" class="general">
<div class="container">
<a href="#"><h1>This text</h1></a>
</div>
</section>
Furthermore, here is the SASS-structured CSS code:
#action {
background-color: $bgLight;
border-top: 1px solid #252525;
-webkit-transition: all 0.2s ease-out;
-moz-transition: all 0.2s ease-out;
-ms-transition: all 0.2s ease-out;
-o-transition: all 0.2s ease-out;
transition: all 0.2s ease-out;
a {
text-decoration: none;
h1 {
margin: 0;
color: $colorLight;
font-weight: 300;
text-align: center;
}
}
}
#action:hover a {
background-color: #76A7D1;
color: $colorDark;
}