美文网首页
CSS实现晴天

CSS实现晴天

作者: lacduang | 来源:发表于2019-08-14 19:20 被阅读0次
    • html
    <div class="weather sunny"></div>
    
    • css
    .weather {
        position: relative;
        display: inline-block;
        width: 180px;
        height: 240px;
        background: #23b7e5;
        border-radius: 8px;
    }
    .sunny:before {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        width: 60px;
        height: 60px;
        background: #F6D963;
        border-radius: 50%;
        box-shadow: 0 0 20px #ff0;
        z-index: 2;
    }
    .sunny:after {
        content: "";
        position: absolute;
        top: 50%;
        left: 50%;
        margin: -45px 0 0 -45px; 
        width: 90px;
        height: 90px;
        background: #FFEB3B;
        clip-path: polygon(
            50% 0%,
            64.43% 25%,
            93.3% 25%,
            78.87% 50%,
            93.3% 75%,
            64.43% 75%,
            50% 100%,
            35.57% 75%,
            6.7% 75%,
            21.13% 50%,
            6.7% 25%,
            35.57% 25%);
        z-index: 1;
        animation: sunScale 2s linear infinite;
    }
    @keyframes sunScale {
        0% {
            transform: scale(1);
        }
        50% {
            transform: scale(1.1);
        }
        100% {
            transform: scale(1);
        }
    }
    

    会实现动态效果


    6665EBAC-F1AF-4d25-AEC1-D6C5A796CDD8.png

    相关文章

      网友评论

          本文标题:CSS实现晴天

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