gpt4 book ai didi

css - 为什么 CSS3 动画不起作用?

转载 作者:行者123 更新时间:2023-11-28 01:53:59 25 4
gpt4 key购买 nike

请指教,为什么下面的 CSS 代码不起作用?我还在 CSS 下编写了 HTML 代码。我想从右向左移动文本,例如 - http://mindgate.in/product/vtransact/

ul.list-points2 li {
animation: linear alternate;
-webkit-animation: linear alternate;
-moz-animation: linear alternate;
-o-animation: linear alternate;
animation-name: run;
animation-duration: 1s;
-webkit-animation-name: run;
-webkit-animation-duration: 1s;
-moz-animation-name: run;
-moz-animation-duration: 1s;
position: relative;
}

@keyframes run {
0% {
right: 0;
}
50% {
left: 100%;
}
100% {
left: 0;
}
}

@-webkit-keyframes run {
0% {
right: 0;
}
50% {
left: 100%;
}
100% {
left: 0;
}
}
<ul class="list-points2">
<li style="color:#fff;margin-bottom: 0;">
<p>Each function is priced Individually</p>
</li>
<li style="color:#fff;margin-bottom: 0;">
<p style="color:#5ec4eb;font-style:italics;">Price closer to <span style="font-style: italic;"><strong>10%</strong> of competition.</span></p>
</li>
<li style="margin-left: 70px;margin-bottom: 0;list-style-type: disc !important;background-image: none;padding-left: 0;">Less than a cup of coffee!</li>
<li style="margin-top: 10px;">Don't believe us? - <em> <strong style="color:#fff600;">TRY IT FOR FREE</strong></em></li>
</ul>

最佳答案

一个选择是给不同的行不同的 animation-delay 动画:

ul.list-points2 li{
animation: linear alternate;
-webkit-animation: linear alternate;
-moz-animation: linear alternate;
-o-animation: linear alternate;
animation-name: run;
animation-duration: 1s;
-webkit-animation-name: run;
-webkit-animation-duration: 1s;
-moz-animation-name: run;
-moz-animation-duration: 1s;
position: relative;
}
ul.list-points2 li:nth-child(3) {
animation-delay:0.2s;
}
ul.list-points2 li:nth-child(4) {
animation-delay:0.4s;
}
@keyframes run {
0% {
right: 0;
}
50% {
left : 100%;
}
100% {
left: 0;
}
}
@-webkit-keyframes run {
0% {
right: 0;
}
50% {
left : 100%;
}
100% {
left: 0;
}
}
<ul class="list-points2">
<li style="color:#fff;margin-bottom: 0;">
<p>Each function is priced Individually</p>
</li>
<li style="color:#fff;margin-bottom: 0;" >
<p style="color:#5ec4eb;font-style:italics;">Price closer to <span style="font-style: italic;"><strong>10%</strong> of competition.</span></p>
</li>
<li style="margin-left: 70px;margin-bottom: 0;list-style-type: disc !important;background-image: none;padding-left: 0;" >Less than a cup of coffee!</li>
<li style="margin-top: 10px;">Don't believe us? - <em> <strong style="color:#fff600;">TRY IT FOR FREE</strong></em></li>
</ul>

关于css - 为什么 CSS3 动画不起作用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49747108/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com