CSS之transition属性

1.鼠标移动到div中背景颜色慢慢变化(1个属性的变化)


 

 
  1. <!DOCTYPE html>  
  2. <html>  
  3. <head>  
  4.     <title></title>  
  5.     <style type="text/css">  
  6.         #block{  
  7.             width: 400px;  
  8.             height: 400px;  
  9.             background: blue;  
  10.             margin: 0 auto;  
  11.             transition: background 3s;  
  12.         }  
  13.         #block:hover{  
  14.             background: red;  
  15.         }  
  16.     </style>  
  17. </head>  
  18. <body>  
  19. <div id="block"></div>  
  20. </body>  
  21. </html>  


2.多个属性的变化

 

transition:属性 时间,属性 时间

3.过度模式

transition:属性 时间 模式

模式:

ease:缓慢开始,缓慢结束

linear:匀速

ease-in:缓慢开始

ease-out:缓慢结束

  ease-in-out:缓慢开始,缓慢结束(和ease稍有区别)

posted @ 2017-10-18 21:02  逗比煎饼侠  阅读(180)  评论(0编辑  收藏  举报