css中的transition属性
CSS transitions 可以决定哪些属性发生动画效果 (明确地列出这些属性),何时开始 (设置 delay),持续多久 (设置 duration) 以及如何动画 (定义timing funtion,比如匀速地或先快后慢)。
css:
.box { border-style: solid; border-width: 1px; display: block; width: 100px; height: 100px; background-color: #0000FF; -webkit-transition:width 2s, height 2s, background-color 2s, -webkit-transform 2s; transition:width 2s, height 2s, background-color 2s, transform 2s; //属性中间用逗号隔开 } .box:hover { background-color: #FFCCCC; width:200px; height:200px; -webkit-transform:rotate(180deg); transform:rotate(180deg); }
html:
盒子的多个属性一起动画: width, height, background-color, transform. 将光标悬停在盒子上查看动画。
对元素的所有属性使用动画过度,在切换元素的样式的时候有动画效果。
transition: all .2s ease-out;
发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/224591.html原文链接:https://javaforall.net
