css3动画奔跑的熊大案例

<!DOCTYPE html>

<html lang="en">

<head>

    <meta charset="UTF-8">

    <meta http-equiv="X-UA-Compatible" content="IE=edge">

    <meta name="viewport" content="width=device-width, initial-scale=1.0">

    <title>Document</title>

    <style>

    body {

        overflow: hidden;

        background-image: linear-gradient(to top, #9890e3 0%,#b1f4cf 100%);

    }

    * {

        margin: 0;

        padding: 0;

    }

    li {

        list-style: none;

    }

    @keyframes move {

        0% {

            top: 700px;

            left: 0;

        }

        100% {

            top: 700px;

            left: 750px;

        }

    }

    @keyframes run {

        0% {

            top: 0;

            left: 0;

        }

        100% {

            top: 0;

            left: -1600px;

        }

    }

    .bear {

        position: relative;

        bottom: 0;

        overflow: hidden;

        width: 200px;

        height: 100px;

        background-color: skyblue;

        animation: move 5s linear forwards;

    }

    .bear img {

        position: absolute;

        animation: run .8s steps(8) infinite;

        z-index: 999999;

    }

    .mon {

        height: 700px;

        animation: mon .5s ease 0s 1 forwards;

    }

    .mon .bg1 {

        position: absolute;

        height: 300px;

        width: 3840px;

        left: 0;

        bottom: -12px;

        z-index: 2;

        background: url(../css动画/images/bg1.png) repeat-x;

        animation: bg 50s linear infinite;

    }

    /* .mon .bg2 {

        position: absolute;

        width: 400px;

        height: 3840px;

        left: 0;

        bottom: -12px;

        z-index: 55;

        background: url(../css动画/images/bg2.png) repeat-x;

        animation: bg 50s linear infinite;

    } */

    .login {

        position: relative;

        top: -750px;

        left: 0;

        width: 400px;

        height: 300px;

        background-image: linear-gradient(120deg, #f6d365 0%, #fda085 100%);

        border: 1px solid black;

        margin: 0 auto;

        padding: 20px 50px;

        border-radius: 30px;

        text-align: center;

    }

    .login h1 {

         color: white;  /*  拼错单词 while 这个单词是错的   */

    }

    .login .input {

        margin-top: 50px;

    }

    .login .box .input {

        margin-top: 20px;

    }

    .login .box .input input {

        outline: none;

        border: 0;

        padding: 10px 10px;

        background-color: #00000000;

        color: white;

    }

    .login   a .loginButton {

        display: inline-block;

        margin-top: 30px;

        width: 200px;

        height: 45px;

        color: #333333;

        border: 0;

        border-radius: 20px;

        line-height: 45px;

        cursor: pointer;

        background-image: linear-gradient(to right, #eea2a2 0%, #bbc1bf 19%, #57c6e1 42%, #b49fda 79%, #7ac5d8 100%);

        text-align: center;

    }

    .input {

        position: relative;

    }

    .input img {

        width: 28px;

        position: absolute;

        top: 3px;

        right: 92px;

    }

    @keyframes mon {

        0% {

            transform: scale(1.5);

        }

        100% {

            transform: scale(1);

        }

    }

    @keyframes bg {

        0% {

            background-position: 0 0;

        }

        100% {

            background-position: -3840px 0;

        }

    }

    </style>

</head>

<body>

    <div class="bear">

        <img src="../css动画/images/bear.png" alt="">

    </div>

    <div class="mon">

        <div class="bg1"></div>

    </div>

    <div class="login">

            <h1>Welcome</h1>

        <div class="box">

            <div class="input">

                <input type="text" placeholder="请输入用户名">

            </div>

            <div class="input">

                <img src="./images/close.png" alt="" id="eye">

                <input type="password" placeholder="请输入密码" id="pwd">

            </div>

            <a href="#"><span class="loginButton">登陆</span></a>

        </div>

    </div>

    <script>

        // 1.获取元素

        var eye = document.getElementById('eye');

        var pwd = document.getElementById('pwd');

        //2.注册事件

        var flag = 0;

        eye.onclick = function() {

            if(flag == 0) {

                pwd.type = 'text';

                eye.src = './images/close.png';

                flag = 1;

            } else {

                pwd.type = 'password';

                eye.src = './images/open.png';

                flag = 0;

            }

        }

    </script>

</body>

</html>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值