【发布时间】:2018-11-25 18:08:04
【问题描述】:
为什么动画改变了z-index?
如果您查看 jsfiddle,您会看到红色图像在顶部,但如果您注释掉动画,蓝色图像在顶部。即使有动画,如何让蓝色图像始终位于顶部?
HTML
<img class="blue" src="http://via.placeholder.com/200/0037ff">
<img class="red" src="http://via.placeholder.com/200/ff0010">
CSS
.red {
-webkit-animation-name: red;
-webkit-animation-duration: 2s;
-webkit-animation-iteration-count: infinite;
animation-name: red;
animation-duration: 2s;
animation-iteration-count: infinite;
}
.blue {
transform: translate(30%);
}
@keyframes red {
from {
transform: translate(50%);
}
to {
transform: translate(0);
}
}
非常感谢任何帮助!
【问题讨论】:
标签: css css-animations css-transforms