Maison >interface Web >tutoriel HTML >CSS3 transition属性_html/css_WEB-ITnose
<head> <title>无标题文档</title> <style> .box{width:100px;height:100px;background:red; transition:500ms;} .box:hover{ background:blue;width:200px;height:200px;} </style></head><body> <div class="box"></div></body>
<head> <title>无标题文档</title> <style> .box{width:100px;height:100px;background:red; transition:500ms width;} .box:hover{ background:blue;width:200px;height:200px;} </style></head><body> <div class="box"></div></body>
<head> <title>无标题文档</title> <style> .box{width:100px;height:100px;background:red; transition:5s width cubic-bezier(0.145,1.295,0.000,1.610);} .box:hover{width:500px;} </style></head><body> <div class="box"></div></body>
<head> <title>无标题文档</title> <style> .box{width:100px;height:100px;background:red; transition:1s width,2s height,3s background;} .box:hover{width:500px;height:300px;background:blue;} </style></head><body> <div class="box"></div></body>
1 <head> 2 <title>无标题文档</title> 3 <style> 4 .box{width:100px;height:100px;background:red; transition:1s width,2s 1s height,3s 3s background;} 5 .box:hover{width:500px;height:300px;background:blue;} 6 </style> 7 </head> 8 <body> 9 <div class="box"></div>10 </body>
<head> <title>无标题文档</title> <style> .box{width:100px;height:100px;background:red; transition:1s width;} </style></head><body> <div class="box" id="box"></div> <script> var oBox=document.getElementById("box"); oBox.onclick=function() { this.style.width=this.offsetWidth+100+"px"; }; addEnd(oBox,function(){ alert("end"); }); function addEnd(obj,fn) { obj.addEventListener('WebkitTransitionEnd',fn,false); obj.addEventListener('transitionend',fn,false); } </script></body>