【发布时间】:2015-10-22 12:38:03
【问题描述】:
我创建了一个简单的效果,使图像在悬停时改变颜色。现在我想添加过渡计时功能属性,以便颜色过渡淡入淡出,而不是立即改变,但我似乎无法让它工作。有什么想法吗?
代码如下:
div {
position: relative;
display: inline-block;
-webkit-transition: all 500ms ease-out 1s;
-moz-transition: all 500ms ease-out 1s;
-o-transition: all 500ms ease-out 1s;
transition: all 500ms ease-out 1s;
}
img {
width: 100%;
height: 100%;
}
div:hover::after {
position: absolute;
z-index: 1;
background-color: Indigo;
opacity: 0.4;
left: 0;
top: 0;
height: 100%;
width: 100%;
content: '';
谢谢!
【问题讨论】:
标签: css hover transition opacity easing