花の回転を達成するためにCSS3

効果には次のとおりです。
画像のキャプション

原則:
実際には非常にシンプルで、真ん中に円の中央に配置され、他の6つの円、異なる絶対位置と回転!
コード:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>CSS实现的旋转的花朵</title>
    <style>
        *{
            margin: 0;
            padding: 0;
        }
        *,*:before,*:after{
            box-sizing: border-box;
        }
        html body{
          height: 100%;
        }
        .container {
            background: #f39c12;
            height: 300px;
            position: relative;
        }
        .loader{
            position: absolute;
            left: 50%;
            top: 50%;
            -webkit-transform: translate(-50%,-50%);
            transform: translate(-50%,-50%);
        }
        .loader .spinnerBlock{
            -webkit-animation: rotate 1000ms linear infinite;
                     animation: rotate 1000ms linear infinite;
            -webkit-transform-origin: center;
                     transform-origin: center;
            display: block;
            width: 50px;
            height: 50px;
        }
        .loader span{
            display: block;
            border: 2px solid #fff;
            border-radius: 50%;
            height: 100%;
            width: 100%;
            position: absolute;
            top: 0;
            left: 0;
        }
        .loader soan:nth-child(1){
            border-color: #eee;
        }
        .loader span:nth-child(2){
            left: -18px;
            top: 10px;
        }
        .loader span:nth-child(3){
            left: -18px;
            top: -10px;
        }
        .loader span:nth-child(4){
            left: 0;
            top: -18px;
        }
        .loader span:nth-child(5){
             left: 18px;
            top: -10px;
          }
        .loader span:nth-child(6){
            left: 18px;
            top: 10px;
        }
        .loader span:nth-child(7){
            left: 0;
            top: 18px;
        }
        @-webkit-keyframes rotate {
            from{
                -webkit-transform: rotate(0deg);
                         transform: rotate(0deg);
            }
            to{
                -webkit-transform: rotate(360deg);
                         transform: rotate(360deg);
            }
        }
        @keyframes rotate {
            from{
                -webkit-transform: rotate(0deg);
                         transform: rotate(0deg);
            }
            to{
                -webkit-transform: rotate(360deg);
                         transform: rotate(360deg);
            }
        }

    </style>
</head>
<body>
    <div class="container">
        <div class="loader">
            <div class="spinnerBlock">
                <span></span>
                <span></span>
                <span></span>
                <span></span>
                <span></span>
                <span></span>
                <span></span>
            </div>
        </div>
    </div>
</body>
</html>

実行コードは、回転の完全な効果を見ることができます!

おすすめ

転載: www.cnblogs.com/baimeishaoxia/p/12036497.html