简体   繁体   English

CSS动画闪烁问题

[英]css animation flicker issue

Css marquee like effect is flickering sometimes. CSS字幕效果有时会闪烁。 The animation is not smooth as we expected. 动画不符合我们的预期。 It stuck sometimes. 有时卡住了。 I tried the solution available on diff stackoverflow posts but that did not help me much. 我在diff stackoverflow帖子上尝试了可用的解决方案,但这并没有太大帮助。

http://codepen.io/anon/pen/vmLGXJ http://codepen.io/anon/pen/vmLGXJ

.marquee {
    width: 100%;
    line-height: 50px;
    background-color: red;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    box-sizing: border-box;

}
.marquee p {
    display: inline-block;
    padding-left: 100%;
    -webkit-backface-visibility: hidden;
-webkit-transform-style: preserve-3d;
    animation: marquee 15s linear infinite;
}
@keyframes marquee {
    from   { transform: translate(0, 0); }
    100% { transform: translate(-100%, 0); }
}
animation: marquee 15s linear infinite; // you can change the time like 15s to 50s

try to write 尝试写

from   { transform: translate(0, 0); }
to { transform: translate(-100%, 0); } /* Instead of 100% */

Also you can try to use all prefix, -moz- and -webkit- 您也可以尝试使用所有前缀-moz-和-webkit-

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM