【发布时间】:2017-08-21 04:39:29
【问题描述】:
所以,我的 CSS 在 3 秒后将 div 移动到 -40px。这样做之后,div 会被移回原来的位置。代码如下:
#jsAlert {
width: 100%;
height: 40px;
position: absolute;
left: 0px;
top: 0px;
background-color: rgba(0, 0, 0, 0.6);
animation:mymove 3s;
animation-delay: 3s;
/*Safari and Chrome*/
-webkit-animation: mymove 2s;
-webkit-animation-delay: 2s;
}
@keyframes mymove {
from {top: 0px;}
to {top: -40px;}
}
@-webkit-keyframes mymove /*Safari and Chrome*/
{
from {top: 0px;}
to {top: -40px;}
}
如何防止 div 返回到原来的位置?
【问题讨论】:
标签: html css css-animations