我正在寻找一种使用 CSS 为悬停过渡设置动画的方法。我希望保持纯CSS。如果没有,我将使用 jquery 作为备份。
这将是我的目标:
带有内容 div 的容器。当悬停时它会动画/向上滑动。如图所示:

我试过类似下面的代码。问题是过渡不会为该auto部分设置动画。内容具有可变高度。所以每次都不一样。(每个网格项目)
.my_container{
position: relative;
width: 100%;
padding-top: 160%;
overflow: hidden;
}
.my_container > .my_content{
position: absolute;
top: 0;
bottom: auto;
left: 0;
right: 0;
}
.my_container > my_content:hover{
top: auto;
bottom: 0;
}
.my_container * {
-webkit-transition: all .6s ease-in-out;
-moz-transition: all .6s ease-in-out;
-o-transition: all .6s ease-in-out;
transition: all .6s ease-in-out;
}
我想过transform: translateY();但据我所知,这只适用于百分比和像素。
目标是让它在悬停时从上到下对齐。
(打字让我想到了另一件事。这在移动设备上没用,对吧?:))