前端CSS3初体验_闹钟练习

最新的前端开发框架 游戏前端开发框架下载 2017web前端开发框架

代码片段 1

<!DOCTYPE html>
<head>
    <meta http-equiv=”Content-Type” content=”text/html; charset=utf-8″ />
    <title>css3练习闹钟效果</title>
    <style>
        body {
            background-image: linear-gradient(to left, #0f1a1c, #2f2422, #596456, #516647, #0f1a1c)
        }
        ul,
        li,
        div {
            margin: 0;
            padding: 0;
        }
        .wrap {
            width: 290px;
            height: 160px;
            margin: 200px auto;
            background: #e34d4d;
            border-radius: 50px;
            box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.1)
        }
        @-webkit-keyframes hoursmove {
            0 {
                transform: rotate(0);
                -webkit-transform: rotate(0);
            }
            10% {
                transform: rotate(360deg);
                -webkit-transform: rotate(360deg);
            }
            11% {
                transform: rotate(0deg);
                -webkit-transform: rotate(0deg);
            }
        }
        @-webkit-keyframes minutesmove {
            0 {
                transform: rotate(0);
                -webkit-transform: rotate(0);
            }
            3% {
                transform: rotate(90deg);
                -webkit-transform: rotate(90deg);
            }
            25% {
                transform: rotate(90deg);
                -webkit-transform: rotate(90deg);
            }
            28% {
                transform: rotate(180deg);
                -webkit-transform: rotate(180deg);
            }
            50% {
                transform: rotate(180deg);
                -webkit-transform: rotate(180deg);
            }
            53% {
                transform: rotate(270deg);
                -webkit-transform: rotate(270deg);
            }
            75% {
                transform: rotate(270deg);
                -webkit-transform: rotate(270deg);
            }
            78% {
                transform: rotate(360deg);
                -webkit-transform: rotate(360deg);
            }
            78.01% {
                transform: rotate(0deg);
                -webkit-transform: rotate(0deg);
            }
        }
        .clock {
            width: 100px;
            height: 100px;
            float: left;
            border-radius: 100%;
            background-image: linear-gradient(to top, #f37171, #e33737);
            margin-left: 23px;
            margin-top: 22px;
            display: inline;
            position: relative;
        }
        .hours {
            width: 4px;
            height: 40px;
            position: absolute;
            left: 48px;
            top: 13px;
            background: #fff;
            border-radius: 2px;
            box-shadow: 0 0 5px 0 rgba(166, 21, 21, 0.8);
            -webkit-box-shadow: 0 0 5px 0 rgba(166, 21, 21, 0.8);
            animation: hoursmove 2.0s ease .1s infinite;
            -webkit-animation: hoursmove 2.0s ease .1s infinite;
            -webkit-transform-origin: 100% 100%;
            transform-origin: 100% 100%;
        }
        .minutes {
            width: 6px;
            height: 27px;
            position: absolute;
            left: 47px;
            top: 26px;
            background: #fff;
            border-radius: 2px;
            box-shadow: 2px 2px 5px 0 rgba(166, 21, 21, 0.8);
            -webkit-box-shadow: 2px 2px 5px 0 rgba(166, 21, 21, 0.8);
            animation: minutesmove 8.0s ease .1s infinite;
            -webkit-animation: minutesmove 8.0s ease .1s infinite;
            -webkit-transform-origin: 50% 100%;
            transform-origin: 50% 100%;
        }
        @-webkit-keyframes txtmove {
            0 {
                transform: translateY(0);
                -webkit-transform: translateY(0)
            }
            3% {
                transform: translateY(-50px);
                -webkit-transform: translateY(-50px)
            }
            25% {
                transform: translateY(-50px);
                -webkit-transform: translateY(-50px)
            }
            28% {
                transform: translateY(-100px);
                -webkit-transform: translateY(-100px)
            }
            50% {
                transform: translateY(-100px);
                -webkit-transform: translateY(-100px)
            }
            53% {
                transform: translateY(-150px);
                -webkit-transform: translateY(-150px)
            }
            75% {
                transform: translateY(-150px);
                -webkit-transform: translateY(-150px)
            }
            78% {
                transform: translateY(-200px);
                -webkit-transform: translateY(-200px)
            }
            78.01% {
                transform: translateY(0);
                -webkit-transform: translateY(0)
            }
        }
        .txt {
            width: 130px;
            height: 50px;
            overflow: hidden;
            line-height: 50px;
            color: #fff;
            position: relative;
            text-shadow: 2px 2px 5px rgba(166, 21, 21, 0.8);
            font-size: 50px;
            font-family: Tahoma, Geneva, sans-serif;
            float: left;
            margin-left: 30px;
            margin-top: 50px;
        }
        .txt ul {
            width: 130px;
            position: absolute;
            left: 0px;
            top: 0px;
            animation: txtmove 8.0s ease .1s infinite;
            -webkit-animation: txtmove 8.0s ease .1s infinite;
        }
        .txt li {
            list-style: none;
            float: left;
        }
    </style>
</head>
<body>
    <div class=”wrap”>
        <div class=”clock”>
            <div class=”hours”></div>
            <div class=”minutes”></div>
        </div>
        <div class=”txt”>
            <ul>
                <li>12:00</li>
                <li>3:00</li>
                <li>6:00</li>
                <li>9:00</li>
            </ul>
        </div>
    </div>
</body>
</html>

前端开发框架2018 前端开发app框架 微信服务号开发前端框架

» 本文来自:前端开发者 » 《前端CSS3初体验_闹钟练习》
» 本文链接地址:https://www.rokub.com/6015.html
» 您也可以订阅本站:https://www.rokub.com
赞(0)
64K

评论 抢沙发

评论前必须登录!