这是我的代码:
.box{
background:#FFF;
-webkit-transition: background 0.5s;
}
.box:hover{
background:#000;
}
但是这样会同时影响onmouseover和onmouseout两个事件,有没有办法控制它们呢?类似这样:
-wekbkit-transition-IN: background 1s;
-webkit-transition-OUT: background 10s;
这是我的代码:
.box{
background:#FFF;
-webkit-transition: background 0.5s;
}
.box:hover{
background:#000;
}
但是这样会同时影响onmouseover和onmouseout两个事件,有没有办法控制它们呢?类似这样:
-wekbkit-transition-IN: background 1s;
-webkit-transition-OUT: background 10s;
只需在 ::after 伪元素中重新定义您的过渡效果。
.box{
background: white;
-webkit-transition: background 5s;
}
.box:hover{
background: olive;
-webkit-transition: background 1s;
}