将鼠标悬停在图像上方时使图像缩放比例变大的问题。 (我使用 ease-in-out 但在 "out" 中它并不像我想要的那样慢)

roblem making an image scale bigger when hovering with the mouse on top of it. (I use ease-in-out but in the "out" it is not slow as I want it to be)

当我将鼠标悬停在包含图像的 div 上时,它会根据需要慢慢变大一点,但是,一旦我用鼠标离开 div,图像就会消失回到原来的位置,没有缓慢而平稳的过渡。为什么?

.stage:hover {
    img {
      transition: all .3s ease-in-out;
      transform: scale(1.03);
    }
  }

当您停止悬停时,img 将停止具有过渡设置,因此它会跳回到初始比例。

尝试将转换放在实际的 img 上:

.stage {
  background-color: gray;
  /* just to show the extent of the stage */
}

.stage img {
  transition: all .3s ease-in-out;
}

.stage:hover img {
  transform: scale(1.03);
}
<div class="stage"><img src="https://picsum.photos/id/1015/200/300"></div>