!DOCTYPE htmlhtmlhead meta charset= " utf-8 " titlecss3图片缓慢放大缩小/title style .div{ width: 500px; height: 500px; margin: 150px auto 0 ; } .div img{ transition: all 2s ease 0s; } /* transition 别放hover里,放到img里,这样
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>css3图片缓慢放大缩小</title> <style> .div{ width: 500px; height: 500px; margin: 150px auto 0; } .div img{ transition: all 2s ease 0s; } /* transition 别放hover里,放到img里,这样移入移出一样缓慢,不然只对hover移上去有缓慢效果 */ .div img:hover{ transform: scale(1.2); /*transition: all 2s ease-in-out 0s;*/ } </style> </head> <body> <div class="div"> <img src="img/img-11-02.jpg"> </div> </body> </html>