css3動畫第一式--簡單翻滾,css3一式翻滾

來源:互聯網
上載者:User

css3動畫第一式--簡單翻滾,css3一式翻滾

在w3cschool上面查閱css3的動畫文法手冊時,發現“css3 動畫”欄目首頁放了一個翻滾的div動畫案例,覺得挺好看的,於是就自己模仿著寫了一下,感覺還行O(∩_∩)O哈哈~

查看原地址

下面放代碼:

<!DOCTYPE html><html lang="zh-cn"><head><meta charset="UTF-8"><title>test</title><style>.box {    position: relative;    margin-top: 50px;    height: 60px;}.test {    position: absolute;    top: 0;    left: 0;    width: 100px;    height: 50px;    font:14px/50px Microsoft YaHei;    text-align: center;    color: #fff;    border-radius: 5px;    background-color: #eb5C7e;    -webkit-animation-name: gogogo;    -webkit-animation-duration: 6s;    -webkit-animation-timing-function:ease;    -webkit-animation-iteration-count: infinite;    animation-name: gogogo;    animation-duration: 6s;    animation-timing-function:ease;    animation-iteration-count: infinite;}@-webkit-keyframes gogogo{    0% {         background-color: #eb5C7e;        -webkit-transform: rotate(0);    }    10% {        background-color: #eb5C7e;        -webkit-transform: rotate(0);        }    30%{        background-color: #1b9e55;        left: 0;         -webkit-transform: rotate(30deg);            }    50%{        left: 400px;        background-color: #2a7df8;        -webkit-transform: rotate(0);    }    70%{        left: 400px;        background-color: #2a7df8;        -webkit-transform: rotate(0);    }        100%{         left:0;        background-color: #eb5C7e;        -webkit-transform: rotate(-360deg);    }}@keyframes gogogo{    0% {         background-color: #eb5C7e;        transform: rotate(0);        }    10% {        background-color: #eb5C7e;        transform: rotate(0);        }    30%{        background-color: #1b9e55;        left: 0;         transform: rotate(30deg);            }    50%{        left: 400px;        background-color: #2a7df8;        transform: rotate(0);    }    70%{        left: 400px;        background-color: #2a7df8;        transform: rotate(0);    }        100%{         left:0;        background-color: #eb5C7e;        transform: rotate(-360deg);    }}</style></head><body>    <div class="box">        <div class="test">            翻滾吧        </div>    </div></body></html>

然後,你可能看不到效果?少年,該升級瀏覽器啦~~~

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.