为什么CSS3动画不起作用?

时间:2018-04-10 06:46:28

标签: css css3 css-animations keyframe

请建议,为什么以下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>

1 个答案:

答案 0 :(得分:0)

一种选择是在动画上为不同的行提供不同的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>