【发布时间】:2021-11-16 14:20:21
【问题描述】:
我正在尝试制作一个类似于本网站顶部的动画 >>> http://www.randstadusa.com。所以,我正在使用 CSS @keyframes。 我能够将箭头向左移动并消失,但我希望它们从左侧重新出现。关于如何使用 css 或其他方法执行此操作的任何想法?到目前为止,这是我:
.arrow {
position: absolute;
left: 50%;
height: 2em;
width: 2em;
color: white;
animation-duration: 10s;
animation-timing-function: ease;
animation-delay: 1.5s;
animation-iteration-count: infinite;
animation-direction: normal;
animation-fill-mode: forwards;
animation-play-state: running;
animation-name: arrows_animation;
}
@keyframes arrows_animation {
0% {left: 50%;}
50% {left: 70%;}
100% {left: 10000px;}
}
<div style="background-color: black; overflow: hidden; height: 200px; width: 100%;">
<div class="arrow">
SOME TEXT
</div>
</div>
【问题讨论】:
-
欢迎来到 Stack Overflow!寻求代码帮助的问题必须包括在问题本身最好在Stack Snippet 中重现它所需的最短代码。见How to create a Minimal, Reproducible Example
-
欢迎来到 SO!我建议所有新访问者阅读How to Ask,以获取有关撰写最能帮助社区提供帮助的帖子的提示。仅关键帧的 CSS 不足以为您提供太多指导 - 最好包括带有 HTML 的 minimal reproducible example 和其他 CSS。