13 - CSS3 - 边框圆角 - 钟表


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


< ! ---------- 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>

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

**钟表**
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,523评论 25 708
  • 曽奇峰:精神分析基础课之25、26 1. 在科胡特的疾病分类学里面,自恋的精神病病理学包括以下四种类型: (1)人...
    皮皮爸爸时代阅读 509评论 0 0
  • 山林里的雨是奇幻无穷的,草原上的雨是豪迈清爽的,都市里的雨是绵绵思情的,而池塘上的雨又是别有情趣的,让我带你...
    干凡凡阅读 384评论 0 1
  • 我的祈祷: 愿世上的每一个人都享有轻而易举的丰盛! 拥有全然的健康、充满爱的关系,经济的独立,富裕和自由的生活! ...
    点滴XY阅读 392评论 0 0
  • 碗子仿席勒~~画画不是争强斗狠,好不好心中自有一杆秤,一百个人有一百个说法,己娱便好。[咖啡]
    瘦人碗子阅读 318评论 0 1