CSS3学习之分享下transition属性

最近在网上看到很多transition写的效果,借鉴http://www.w3school.com.cn分享下代码,

1.语法:transition: property duration timing-function delay;

transition-property 规定设置过渡效果的 CSS 属性的名称。
none 没有属性会获得过渡效果。
all 所有属性都将获得过渡效果。
property 定义应用过渡效果的 CSS 属性名称列表,列表以逗号分隔。
transition-duration: 规定完成过渡效果需要多少秒或毫秒。
transition-timing-function: 规定速度效果的速度曲线。
linear 规定以相同速度开始至结束的过渡效果(等于 cubic-bezier(0,0,1,1))。
ease 规定慢速开始,然后变快,然后慢速结束的过渡效果(cubic-bezier(0.25,0.1,0.25,1))。
ease-in 规定以慢速开始的过渡效果(等于 cubic-bezier(0.42,0,1,1))。
ease-out 规定以慢速结束的过渡效果(等于 cubic-bezier(0,0,0.58,1))。
ease-in-out 规定以慢速开始和结束的过渡效果(等于 cubic-bezier(0.42,0,0.58,1))。
cubic-bezier(n,n,n,n) 在 cubic-bezier 函数中定义自己的值。可能的值是 0 至 1 之间的数值。
transition-delay:  定义过渡效果何时开始。

2.css: 

.box{width:100px;height:100px;position:relative; background-color:#F00;transition:width 2s ease 2s,height 2s ease-out 2s,color 2s ease,top 2s;}
.box:hover{width:200px;height:200px; background-color:#0FF;top:-10px;}
/*-moz-transition:*//* Firefox 4 */
/*-webkit-transition:*//* Safari 和 Chrome */
/*-o-transition:*//* Opera */

3.html:

<!--把鼠标放到 div 元素上,宽度会从 100px 逐渐变为 200px:-->
<div class="box"></div>

4.浏览效果:

  

备注:这个方法不适合IE10以下的浏览器

原文地址:https://www.cnblogs.com/ninali/p/3656758.html