首页 > 代码库 > transition

transition

适用于:所有元素,包含伪对象:after和:before

[ transition-property ]:检索或设置对象中的参与过渡的属性[ transition-duration ]:检索或设置对象过渡的持续时间[ transition-timing-function ]:检索或设置对象中过渡的动画类型[ transition-delay ]:检索或设置对象延迟过渡的时间

缩写方式:

transition:border-color .5s ease-in .1s, background-color .5s ease-in .1s, color .5s ease-in .1s;





<!DOCTYPE html>
<html lang="zh-cn">
<head>
<meta charset="utf-8" />
<title>transition_CSS参考手册_web前端开发参考手册系列</title>
<meta name="author" content="Joy Du(飘零雾雨), dooyoe@gmail.com, www.doyoe.com" />
<style>
h1{font-size:16px;}
.test{overflow:hidden;width:100%;margin:0;padding:0;list-style:none;}
.test li{float:left;width:100px;height:100px;margin:0 5px;border:1px solid #ddd;background-color:#eee;text-align:center;-moz-transition:background-color .5s ease-in;-webkit-transition:background-color .5s ease-in;-o-transition:background-color .5s ease-in;-ms-transition:background-color .5s ease-in;transition:background-color .5s ease-in;}
.test li:nth-child(1):hover{background-color:#bbb;}
.test li:nth-child(2):hover{background-color:#999;}
.test li:nth-child(3):hover{background-color:#630;}
.test li:nth-child(4):hover{background-color:#090;}
.test li:nth-child(5):hover{background-color:#f00;}
</style>
</head>
<body>
<h1>请将鼠标移动到下面的矩形上:</h1>
<ul class="test">
 <li>背景色过渡</li>
 <li>背景色过渡</li>
 <li>背景色过渡</li>
 <li>背景色过渡</li>
 <li>背景色过渡</li>
</ul>
</body>
</html>
   

transition