当鼠标离开按钮时,为什么我的动画不会“回滚”(动画),就像鼠标进入按钮时一样?
.container {
padding: 20px 0 0 10px;
}
.button {
color: #ffffff;
background: #71b3c7;
text-decoration: none;
-webkit-backface-visibility: hidden;
-webkit-transition: border-color 0.4s, color 0.4s;
transition: border-color 0.4s, color 0.4s;
position: relative;
text-align: center;
padding: 8px 14px;
font-size: 20px;
text-transform: uppercase;
font-family: "Open Sans", Arial, sans-serif;
font-weight: bold;
letter-spacing: 1.4px;
}
.button span {
position: relative;
z-index: 2;
}
.button:before {
content: '';
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
z-index: 1;
opacity: 0;
-webkit-transform: scale3d(0.1, 1, 1);
transform: scale3d(0.1, 1, 1);
-webkit-transition: -webkit-transform 0.4s, opacity 0.4s;
transition: transform 0.4s, opacity 0.4s;
-webkit-transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
transition-timing-function: cubic-bezier(0.2, 1, 0.3, 1);
-webkit-transform-origin-x: 0;
}
.button:hover {
color: #fff;
}
.button:hover:before {
opacity: 1;
background: #2a9276;
-webkit-transform: translate3d(0, 0, 0);
transform: translate3d(0, 0, 0);
}
<div class="container">
<a href="#" class="button"><span>button</span></a>
</div>