Reputation: 179
My css:
.sec-hover :hover {background:pink;}
My div:<div class="sec-hover"><h2>heading</h2><p>paragraph</p></div>
With this code, the whole div does not hover in pink. On hover the h2 and p elements hover pink separately. How do I get the whole div to hover pink?
codepen: [1]: http://codepen.io/cboy/pen/GWgOGa
Upvotes: 2
Views: 3711
Reputation: 3320
Try This ! Used proper syntax ;
.sec-hover:hover{
background:pink;
color:white;
}
<div class="sec-hover">
<h2>heading</h2>
<p>paragraph</p>
</div>
Upvotes: 0
Reputation: 6626
Use background-color
.sec-hover:hover{
background-color: pink
}
<div class="sec-hover"><h2>heading</h2><p>paragraph</p></div>
Upvotes: 1
Reputation: 1817
No space before colon : , Try this :
.sec-hover:hover{
background: pink
}
Upvotes: 5