介紹css3過渡和動畫有哪些區別

來源:互聯網
上載者:User

CSS3 過渡

CSS3中,我們為了添加某種效果可以從一種樣式轉變到另一個的時候,無需使用Flash動畫或JavaScript。用滑鼠移過下面的元素:

也就是說我們設定好元素過渡後,突然間改變元素的屬性,它會緩慢的過渡過去,

列入下面方法,當突然改變元素寬度時候,它會2秒後變成你改變的值

div{    transition: width 2s;    -webkit-transition: width 2s; /* Safari */}

CSS3 動畫

CSS3,我們可以建立動畫,它可以取代許多網頁動畫映像,Flash動畫,和JAVAScripts。

@keyframes myfirst{    from {background: red;}    to {background: yellow;}}  @-webkit-keyframes myfirst /* Safari 與 Chrome */{    from {background: red;}    to {background: yellow;}}

動畫是預設定好動畫過程,css3會按照這個過程執行。

相關文章

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.