css動畫效果之一

來源:互聯網
上載者:User

標籤:

    <head>        <meta charset="UTF-8">        <title></title>        <style type="text/css">            .box {                width: 100px;                height: 100px;                background: #5CBE3E;                animation-name: fromLeftToRight;/*   取個名字 */                animation-duration: 4s; /*  //變化所要的時間 */                animation-iteration-count: infinite;                 /* 要迴圈多小次 */   /* (無數次迴圈) */            }            /* 定義動畫 */                      /*  用名字要和(取個名字)一樣 */            @keyframes fromLeftToRight {                from { /*  從什麼開始 */                    margin-left: 0;                }                to { /* 到什麼結束 */                    margin-left: 100px;                }            }        </style>    </head>    <body>        <div class="box"></div>    </body>

  

   <head>        <meta charset="UTF-8">        <title></title>        <style type="text/css">            .box {                width: 100px;                height: 100px;                background: #5CBE3E;                margin: 5px;                animation-name: fromLeftToRight;/*取個名字 */                animation-duration: 3s;/*多小時間迴圈一次 */                animation-iteration-count: infinite;            }    /* 要迴圈多小次 */      /*(無限次迴圈) */              .box:hover {                animation-play-state: paused;            }/* 當滑鼠放在圖片上時圖片不移動 */                        .reverse {                animation-direction: reverse;            } /* 從結束到開始地點 */                        .alternate {                animation-direction: alternate;            } /*從開始到結束再從結束到開始 */                        .alternate-reverse {                animation-direction: alternate-reverse;            }/*從結束到開始再開始到結束 */                        @keyframes fromLeftToRight {                from {/* 從什麼開始 */                    margin-left: 0;                }                to {/* 到什麼結束 */                    margin-left: 300px;                }            }        </style>    </head>    <body>        <div class="box"></div>        <div class="box reverse"></div>        <div class="box alternate"></div>        <div class="box alternate-reverse"></div>    </body>

  

   <head>        <meta charset="UTF-8">        <title></title>        <style type="text/css">            img {                opacity: 0;            }                        img:hover {                animation: fadeIn 1s ease-in forwards;            } /* hover的變化過程1秒 */                        @keyframes fadeIn {                from {/* 從什麼 */                    opacity: 0;                }                to {/* 到什麼 */                    opacity: 1;                }            }        </style>    </head>    <body>        <img src="images/1.jpg" alt="一張圖片        " width="300" />    </body>

  

css動畫效果之一

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.