<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>JS Bin</title> <style type='text/css'> img{ width:200px; height:200px;transition:1s;}//transition的作用在于,指定状态变化所需要的时间。 img:hover{ width:400px; height:400px;} </style> </head> <body> <img src='http://img.mymhotel.com/front/suprise1209.jpg'> </body> </html>
//我们可以指定transition适用的属性,比如只适用于height
transition:1s height;
//源文地址:http://www.ruanyifeng.com/blog/2014/02/css_transition_and_animation.html