用户登录
用户注册

分享至

纯CSS实现的图片切换效果

  • 作者: 月城泪远
  • 来源: 51数据库
  • 2022-08-15
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>CSS3实现轮播图效果</title>
<style>
    @-webkit-keyframes slide {
        0% {
            background-position: 0 0;
        }
        10%, 25% {
            background-position: -600px 0;
        }
        35%, 50% {
            background-position: -1200px 0;
        }
        60%, 75% {
            background-position: -1800px 0;
        }
        85%, 100% {
            background-position: 0 0;
        }
    }
    @-moz-keyframes slide {
        0% {
            background-position: 0 0;
        }
        10%, 25% {
            background-position: -600px 0;
        }
        35%, 50% {
            background-position: -1200px 0;
        }
        60%, 75% {
            background-position: -1800px 0;
        }
        85%, 100% {
            background-position: 0 0;
        }
    }
    @-o-keyframes slide {
        0% {
            background-position: 0 0;
        }
        10%, 25% {
            background-position: -600px 0;
        }
        35%, 50% {
            background-position: -1200px 0;
        }
        60%, 75% {
            background-position: -1800px 0;
        }
        85%, 100% {
            background-position: 0 0;
        }
    }
    @keyframes slide {
        0% {
            background-position: 0 0;
        }
        10%, 25% {
            background-position: -600px 0;
        }
        35%, 50% {
            background-position: -1200px 0;
        }
        60%, 75% {
            background-position: -1800px 0;
        }
        85%, 100% {
            background-position: 0 0;
        }
    }
    .slide-box {
        margin: 0 auto;
        width: 600px;
        height: 400px;
        border: 1px solid #ddd;
        background: url(http://sandbox.runjs.cn/uploads/rs/376/uazzmdfd/bg.png) 0 0 no-repeat;
        -webkit-animation: slide 8s linear infinite;
        -o-animation: slide 8s linear infinite;
        animation: slide 8s linear infinite;
    }
</style>
</head>
<body>
    <div class="slide-box"></div>
</body>
</html>
软件
前端设计
程序设计
Java相关