CSS练习_云层效果

之前练习的一个网页,只利用css完成,算是一个小demo吧

想要的效果:

  • 云层无限滚动
  • 背景天空会由白变黑再变白
  • 云层滚动有视差(速度不同)

效果图:



代码:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>5_动画模块_云层效果</title>
    <style> * {
     margin: 0; padding: 0; } ul {
     height: 400px; background-color: skyblue; margin-top: 100px; animation: change 5s linear 0s infinite alternate; position: relative; overflow: hidden; } ul li {
     width: 400%; height: 100%; position: absolute; left: 0; top: 0; list-style: none; } ul li:nth-child(1) {
     background-image: url("pic/yun1.png"); animation: one 30s linear 0s infinite alternate; } @keyframes one {
     from{
    margin-left: 0px; } to{
    margin-left: -100%; } } ul li:nth-child(2) {
     background-image: url("pic/yun2.png"); animation: two 30s linear 0s infinite alternate; } @keyframes two {
     from {
    margin-left: 0px; } to {
    margin-left: -200%; } } ul li:nth-child(3) {
     background-image: url("pic/yun3.png"); animation: three 30s linear 0s infinite alternate; } @keyframes three {
     from {
    margin-left: 0px; } to {
    margin-left: -300%; } } @keyframes change {
     from {
     background-color: skyblue; } to {
     background-color: black; } } </style>
</head>
<body>
<ul>
    <li></li>
    <li></li>
    <li></li>
</ul>
</body>
</html>

yun1.png,到yun3.png:


ps扣的,不咋滴

全部评论

相关推荐

不愿透露姓名的神秘牛友
12-10 15:21
华为-媒体院 算法 n*16 硕士985
点赞 评论 收藏
分享
10-20 11:11
辽宁大学 营销
点赞 评论 收藏
分享
冲鸭2024:亚信不去也罢
投递亚信科技(中国)有限公司等公司6个岗位
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务