【发布时间】:2019-06-04 09:16:19
【问题描述】:
我有一个简单的菜单/子菜单
<ul>
<li class="parent">
parent
<div class="child">
some stuff
</div>
</li>
</ul>
这里是css
.parent { position : relative ; display:inline-block; background:green ; width:500px ; height : 50px }
.child {
position: absolute ; display:none ; background:red ;width:100% ; bottom:-100px ; height : 50px;opacity:0 ;
transition: all 1s ease-in-out;
-webkit-transition: all 1s ease-in-out;
-moz-transition: all 1s ease-in-out;
-o-transition: all 1s ease-in-out;
-ms-transition: all 1s ease-in-out;
}
.parent:hover .child { display:block ; bottom:-50px ; opacity : 1 }
这里是 jsfiddle
https://jsfiddle.net/7o3fxqvr/1/
基本上我希望当鼠标悬停在父级上时出现子级...也
bottom 从 -100px 变为 -50px 以显示 child 向 parent 移动一点,bottom 的这种变化应该显示为动画,但它只是跳到上面,似乎没有动画
【问题讨论】:
标签: html css animation transition