How can I use pure CSS to make an image appear when hovering over text?
HTML
<h1 id="hover">Hover over me</h1>
<div id="squash">
<img src="http://askflorine.com/wp-content/uploads/2013/10/temp_quash.jpg" width="100%">
</div>
CSS
#squash {
display: none;
}
#hover:hover + #squash {
display: block;
}
While this method works well, it becomes complicated if anything is placed between the <h1>
and the <div>
due to the CSS selector used (+
). Is there a way to trigger a change in CSS on one element based on an event in another?