作为一名学生,我正在制作自己的作品集。
对于页眉,我尝试创建一个天空效果,使用CSS和关键帧来实现水平滚动的图像。我的问题是,当图像到达末尾时,它会“重置”,而不是继续平稳滚动。
有没有办法让它无限制地继续滚动?(我将持续时间更改为5秒,只是为了不让您等待40秒:p)
对于页眉,我尝试创建一个天空效果,使用CSS和关键帧来实现水平滚动的图像。我的问题是,当图像到达末尾时,它会“重置”,而不是继续平稳滚动。
有没有办法让它无限制地继续滚动?(我将持续时间更改为5秒,只是为了不让您等待40秒:p)
@keyframes animatedBackground {
from { background-position: 0 0; }
to { background-position: 100% 0; }
}
#header-top {
height: 190px;
background-image: url('http://image.noelshack.com/fichiers/2016/46/1479595480-clouds.png');
background-repeat: repeat-x;
animation: animatedBackground 5s linear infinite;
line-height: 400px;
}
<div id="header-top">
</div>
Gif
为例。 - Mohammad Al Baghdadi