所以这是我的代码,当我悬停图像时,我希望使用css3过渡淡入文本和背景颜色.我已经尝试了很多选择器和过渡类型,但似乎无法得到任何帮助非常感谢.
见下面的演示
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>
Run Code Online (Sandbox Code Playgroud)
和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;
}
Run Code Online (Sandbox Code Playgroud)