CSS Webkit Transition - 淡出比淡入慢
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5668497/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-30 00:15:41 来源:igfitidea点击:
CSS Webkit Transition - Fade out slowly than Fade in
提问by Adam
This is what I have:
这就是我所拥有的:
.box{
background:#FFF;
-webkit-transition: background 0.5s;
}
.box:hover{
background:#000;
}
But this appends to both onmouseoverand onmouseoutactions, but isn't there a way to control them? Something like:
但这会附加到onmouseover和onmouseout操作,但是没有办法控制它们吗?就像是:
-wekbkit-transition-IN: background 1s;
-webkit-transition-OUT: background 10s;
回答by Yoann
Just redifine your transition in the over pseudo element.
只需在 over 伪元素中重新定义您的过渡。
.box{
background: white;
-webkit-transition: background 5s;
}
.box:hover{
background: olive;
-webkit-transition: background 1s;
}