这是 CSS:
body {
background-image: url(SMback.jpg);
color: #ecf2f9;
text-align: center;
-webkit-animation: bgscroll 20s infinite linear;
-moz-animation: bgscroll 20s infinite linear;
-ms-animation: bgscroll 20s infinite linear;
-o-animation: bgscroll 20s infinite linear;
}
我没有设置 div,只是一个简单的 HTML 框架。图像出现时没有滚动。我可以在这里做得更好吗?
最佳答案
您是否记得为 bgscroll 动画定义关键帧?
@keyframes bgscroll
{
from {background-position:0 0;}
to {background-position:0 200px;}
}
这里有一个 fiddle 可以帮助您:http://jsfiddle.net/JC9e8/
关于html - 尝试使用 bgrnd img scroll,无济于事,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20436301/