zoukankan      html  css  js  c++  java
  • 边框旋转效果

    <!DOCTYPE html>
    <html lang="en">
    
    <head>
        <meta charset="UTF-8">
        <title>rotate</title>
    </head>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        
        .wrapper {
            width: 170px;
            height: 170px;
            margin: 20px;
            border: 1px solid #00FF7F;
            background-color: #fff;
            position: relative;
            overflow: hidden;
            border-radius: 3px;
        }
        
        .wrapper:after,
        .wrapper:before {
            content: '';
            position: absolute;
            width: 240px;
            height: 240px;
            top: 50%;
            left: 50%;
            animation: active 8s linear infinite;
            transform-origin: 0 0;
        }
        
        .wrapper:after {
            background: linear-gradient(to left, #00FF7F, #fff);
        }
        
        .wrapper:before {
            animation-delay: -4s;
            background: linear-gradient(to left, #fff, #00FF7F);
        }
        
        @keyframes active {
            from {
                transform: rotate(0deg)
            }
            to {
                transform: rotate(360deg)
            }
        }
        
        .main,
        .content {
            position: absolute;
            width: 150px;
            height: 150px;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            z-index: 1;
            border: 1px solid #ececec;
            background: #fff;
            z-index: 10;
        }
        
        .main:after,
        .main:before {
            content: '';
            position: absolute;
            width: 240px;
            height: 240px;
            top: 50%;
            left: 50%;
            animation: activeMain 8s linear infinite;
            transform-origin: 0 0;
            z-index: -1;
        }
        
        .main:after {
            background: linear-gradient(to left, #3CB371, #fff);
        }
        
        .main:before {
            background: linear-gradient(to left, #fff, #20B2AA);
            animation-delay: -4s;
        }
        
        @keyframes activeMain {
            from {
                transform: rotate(90deg)
            }
            to {
                transform: rotate(450deg)
            }
        }
    </style>
    
    <body>
        <div class="wrapper">
            <div class="main"></div>
            <div class="content"></div>
        </div>
    </body>
    
    </html>
  • 相关阅读:
    【UVa 1592】Database
    【UVa 400】Unix ls
    【UVa 136】Ugly Numbers
    【UVa 540】Team Queue
    【Uva 12096】The SetStack Computer
    【POJ 1050】To the Max
    【UVa 156】Ananagrams
    【UVa 10815】Andy's First Dictionary
    [HNOI/AHOI2018]转盘
    CF46F Hercule Poirot Problem
  • 原文地址:https://www.cnblogs.com/lgjc/p/11088436.html
Copyright © 2011-2022 走看看