css - 动画 CSS3 不适用于此悬停图像

标签 css animation background css-transitions css-animations

我有一张图片,其背景在悬停时发生变化,我想为其添加悬停。

这里是我要补充的内容:

  -webkit-transition: all 1s ease-in-out;

这是在线版本: http://jsfiddle.net/jmXdh/2/

最佳答案

DEMO

这就是您正在寻找的解决方案!

HTML CHANGES
<a href="/">
<img class="imghover" src="http://i42.tinypic.com/2v9zuc1.jpg"/>
<img class="img" src="http://i40.tinypic.com/i3s4dc.png"/>
</a>

CSS IMPROVEMENTS
.img{
    z-index:1;
    margin-left: -190px;
    margin-bottom:5px;
    opacity:0;
    -webkit-transition:opacity 0.5s;
}
.img:hover{
    opacity:1;
}
.imghover{
    z-index:-100;
}

关于css - 动画 CSS3 不适用于此悬停图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17254570/

相关文章:

html - 在我的 html 页面底部居中放置下一个和上一个按钮

c# - 为什么绑定(bind)不适用于动画?

javascript - jQuery停止动画方法

iphone - 从后台退出时重新启动应用程序

html - 如何在html中的标题框架上设置搜索输入框

html - 使所有列为窗口高度的 100%

javascript - 如何清除 AngularJs 服务器缓存和 cookie?

css - iOS 上的动画 stroke-dashoffset

c# - 如何向 LayoutDocumentPane 添加背景图像?

java - 设置背景颜色 : Android