#gallery{ .oneimg{ width:150px; height:150px; padding:10px; float:left; border:1px solid #eee; margin: 5px; .showImage{ width:150px; height:150px; display:block; overflow:hidden; img{ -webkit-transition-property: margin-top; -webkit-transition-duration: 0.2s; -webkit-transition-timing-function: ease-out; margin:0px; } &:hover{ img{ -webkit-transition-property: margin-top; -webkit-transition-duration: 0.4s; -webkit-transition-timing-function: ease-out; margin-top: -40px; } } } } }