I have been trying to implement CSS3 transitions to create a hover effect where the text and background color fade in when hovering over an image. Despite my attempts with various selectors and transition types, I can't seem to achieve the desired result. Any assistance would be greatly appreciated.
Check out the demo below:
http://jsfiddle.net/jiceb/xsFmA/
<a href="#">
<h2>Some Text</h2>
<img src="http://www.sheridanrogers.com.au/wp-content/uploads/2011/03/American-pancakes.jpg"/>
</a>
Here is the corresponding CSS:
a { position: relative; display: inline-block }
a img {
width:250px;
}
a h2 {
display: none;
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
margin: 0;
background: black;
color: #fff;
}
a:hover h2 {
display: block;
}