我将div悬停在其上方时从50px的高度扩展到125px。我想在div的底部放置一些文本和图像,以便将其隐藏起来,直到div扩展为止,并且随着扩展在其上方滚动而显示出来。这是我在CSS中扩展的语法:

.Home {
height:50px;
width:100px;
display:inline-block;
position:relative;
z-index:1;
transition: height .5s ease-in-out;
-webkit-transition: height .5s ease-in-out;
}

.Home:hover {
height 150px;
}


有人可以帮我指出正确的方向吗?

最佳答案

您只需要在.Home类定义中添加overflow:hidden。还要在.Home:hover类的高度后添加冒号。

.Home { height:50px;
width:100px;
display:inline-block;
position:relative;
z-index:1;
transition: height .5s ease-in-out;
-webkit-transition: height .5s ease-in-out;
overflow:hidden;
}

09-25 17:38
查看更多