菜鸟学堂
在线运行
源代码
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>菜鸟学堂(edu.jb51.net)</title> <style> div { width:100px; height:50px; background:red; color:white; font-weight:bold; transition:width 2s; -webkit-transition:width 2s; /* Safari */ } #div1 {transition-timing-function: linear;} #div2 {transition-timing-function: ease;} #div3 {transition-timing-function: ease-in;} #div4 {transition-timing-function: ease-out;} #div5 {transition-timing-function: ease-in-out;} /* Safari */ #div1 {-webkit-transition-timing-function: linear;} #div2 {-webkit-transition-timing-function: ease;} #div3 {-webkit-transition-timing-function: ease-in;} #div4 {-webkit-transition-timing-function: ease-out;} #div5 {-webkit-transition-timing-function: ease-in-out;} div:hover { width:300px; } </style> </head> <body> <p><b>注意:</b> 该属性不兼容 IE 9 以及更早版本的浏览器</p> <div id="div1" style="top:100px">linear</div> <div id="div2" style="top:150px">ease</div> <div id="div3" style="top:200px">ease-in</div> <div id="div4" style="top:250px">ease-out</div> <div id="div5" style="top:300px">ease-in-out</div> <p>将鼠标移动至块上查看过渡动画效果.</p> </body> </html>
运行结果
在线运行
菜鸟学堂 edu.jb51.net