transform的屬性scale(x,y) 對元素進行縮放,x表示水平方向縮放倍數,y表示垂直方向的縮放倍數,y是可選參數,不設置,則表示兩個方向的倍數是一樣的,基點一樣在元素的中心位置。
還有單向拉伸的scaleX和scaleY。
<html> <head> <title>Demo</title> <style type="text/css"> .box{width:300px; height:169px;overflow:hidden;} .suofang{display:block;width:300px; height:169px;transition: all 1s ease 0s;} .suofang:hover{-webkit-transform:scale(2,2);-moz-transform:scale(2,2);-o-transform:scale(2,2);} </style> </head> <body><div class="box"> <a href="#" class="suofang" style="background:url(suo.jpg) no-repeat;"></a> </div> </body> </html>