標籤: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過度詳解