简体   繁体   English

悬停时的过渡效果

[英]Transition effect on hover

i'm stuck with simple thing, not able to resolve this. 我坚持简单的事情,无法解决这个问题。 When i hover over an li element in html, i've made it so that a few other li's go down (form of a dropdown menu). 当我将鼠标悬停在html中的li元素上时,我已经做到了,以便其他几个li掉下来(下拉菜单的形式)。

However, i'm trying to find a way to get that dropdown have a transition effect on dropping down, but i'm can't figure it out... 但是,我正在尝试找到一种方法来使下拉菜单对下拉菜单具有过渡效果,但是我无法弄清楚...

Link to that is: 链接是:

`https://jsfiddle.net/cphtd3ge/`

I would really much appreciate it if someone can assist me with this. 如果有人可以协助我,我将非常感激。 I'm still learning and i want to learn as much as i can. 我仍在学习,我想学习更多。

I've updated your jsfiddle, hope this helps. 我已经更新了您的jsfiddle,希望对您有所帮助。 https://jsfiddle.net/cphtd3ge/21/ https://jsfiddle.net/cphtd3ge/21/

You need to add the transition onto the selector you want to animate, not its children. 您需要将transition添加到要设置动画的选择器上,而不是其子代上。 I also used max-height instead of height because you can't transition from 0px to auto in CSS. 我还使用了max-height而不是height因为您不能在CSS中从0px转换为auto

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM