2016-09-21 250 views

回答

5

检查这个片段:

p{ 
 
    white-space: nowrap; 
 
    overflow: hidden; 
 
    width: 30em; 
 
    animation: linearwipe 6s steps(60, end); 
 
} 
 

 
@keyframes linearwipe{ 
 
    from { width: 0; } 
 
}
<p>Text linear wipe </p>

+0

感谢哥们,我想要相同的效果,但文本不应该移动。它应该在同一个地方。恩。 “输入文字”。 –

+0

这正是我想要的,我们可以添加一些不透明度从0到100%? –

+2

是的,你可以添加'不透明度:0;'到'不透明度:1;' –

0

这段代码完全工作:

CSS:

.linear-wipe{ 
    white-space: nowrap; 
    overflow: hidden; 
    animation: linearwipe 1s steps(100, end); 
    opacity: 1; 
    width: 0%; 
} 

@keyframes linearwipe{ 
    from { width: 0;opacity: 0 } 
}