transition Css3過度詳解

來源:互聯網
上載者:User

標籤:style   blog   io   color   sp   for   div   on   log   

過度文法:.example {       transition-property: background-color;     //需要過度的css屬性    transition-duration: 2s;               //過度所需要的時間    transition-timing-function: ease-in;   //過度的類型    transition-delay: 1s;   //過度延遲的時間} 大家都知道css代碼是要簡寫的:過渡簡寫:example {       transition: background-color 2s ease-in 1s;   } 多項過度:.example {       transition:  background-color  2s ease-in 1s,                    width  2s ease-in-out,                    height 3s ease-out;   } 觸發事件過渡:----例如  click  hover  類似的事件1、背景過度,一個背景為綠色當滑鼠hover時延遲1s過度到藍色;.example {       background-color: green;       transition: background-color  2s ease-in 1s;   }   .example:hover {       background-color: blue   } 2、當使用者單擊並按住元素時,發生寬度屬性過渡,因此該元素保持 "活動" 狀態。.example {       width: 200px;       height: 200px;       transition: width  2s ease-in;   }   .example:active {       width: 400px;   } 3、當你輸入元素的時候input會變寬;input {       width: 200px;       transition: width 2s ease-in;   }   input:focus {       width: 250px;   }  4、可以幾個屬性同時進行變化;.example {       width: 200px;       height: 200px;       background:#000;    -webkit-transition: width 2s ease,         height 2s ease, background 2s ease;    -webkit-transform: translateZ(0);   }   .example:hover {       width: 300px;       height: 300px;       background:green;} 

 

transition Css3過度詳解

聯繫我們

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