美文网首页CSS/CSS3
13 - CSS3 - 边框圆角 - 钟表

13 - CSS3 - 边框圆角 - 钟表

作者: 西巴撸 | 来源:发表于2017-03-04 18:48 被阅读33次

    本文是针对刚学编程的小白,都是一些基础知识,如果想了解更多深层一点的东西,欢迎移步本人博客!!
    博客地址 点击跳转


    < ! ---------- HTML ----------- >

    <div class="clock">
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div></div>
        <div class="cover"></div>
        <div class="hour"></div>
        <div class="minute"></div>
        <div class="second"></div>
        <div class="dot"></div>
    </div>
    

    < ! --------- Style --------------- >

    <style>
        *{
            margin: 0;
            padding: 0;
        }
        .clock{
            width: 400px;
            height: 400px;
            margin: 100px auto;
            border: 10px solid #000;
            box-sizing: border-box;
            border-radius: 50%;
            position: relative;
        }
        .clock div{
            width: 8px;
            height: 380px;
            background-color: #ccc;
            position: absolute;
            left: 50%;
            margin-left:-4px;
        }
        .clock div:nth-child(1){
            width: 14px;
            margin-left:-7px;
        }
        .clock div:nth-child(2){
            transform: rotateZ(30deg);
        }
        .clock div:nth-child(3){
            transform: rotateZ(60deg);
        }
        .clock div:nth-child(4){
            transform: rotateZ(90deg);
            width: 14px;
            margin-left:-7px;
        }
        .clock div:nth-child(5){
            transform: rotateZ(120deg);
        }
        .clock div:nth-child(6){
            transform: rotateZ(150deg);
        }
        .clock .cover{
            width: 320px;
            height: 320px;
            background-color: white;
            border-radius: 50%;
            margin-left:-160px;
            top: 50%;
            margin-top:-160px;
        }
        .clock .hour{
            width: 20px;
            height: 100px;
            background-color: black;
            margin-left:-10px;
            top: 100px;
            animation: sport 43200s linear 0s infinite normal;
        }
        .clock .minute{
            width: 14px;
            height: 120px;
            background-color: black;
            margin-left:-7px;
            top: 80px;
            animation: sport 3600s linear 0s infinite normal;
        }
        .clock .second{
            width: 10px;
            height: 150px;
            background-color: red;
            margin-left:-5px;
            top: 50px;
            animation: sport 60s steps(60) 0s infinite normal;
        }
        .clock .dot{
            width: 30px;
            height: 30px;
            background-color: black;
            border-radius: 50%;
            margin-left:-15px;
            top: 50%;
            margin-top:-15px;
        }
        @keyframes sport {
            from{
                transform: rotateZ(0deg);
                transform-origin: center bottom;
            }
            to{
                transform: rotateZ(360deg);
                transform-origin: center bottom;
    
            }
        }
    </style>
    

    < ! --------- 效果展示 ---------- >

    **钟表**

    相关文章

      网友评论

        本文标题:13 - CSS3 - 边框圆角 - 钟表

        本文链接:https://www.haomeiwen.com/subject/koejgttx.html