Ichiban Ichiban - 1 year ago 86
CSS Question

zoom transition when the mouse is out of the image

I haven't found an answer, I have an image on my website and with

I have a small zoom transition when my mouse is on the image but if the mouse is out, there is no transition
Is it possible to add a smooth transition to the initial position ?
If yes, how ?


Answer Source

You need to add the transition to the element, and not the :hover.

img {
  height: 200px;
  transition: all 0.4s;
img:hover {
  transform: scale(1.2);
<img src="http://butlers-web.com/Content/Images/BW%20Logo%203.0.png" />

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download