CSS下拉菜单(在子元素是时停止父元素从处于活动状态)
-
14-11-2019 - |
题
我有一个项目,我正在为一些简单的CSS按钮工作,我试图为它们进行匹配的下拉菜单。问题是,当我单击子菜单中的项目时,它的所有父母也会转到活动状态。我打算使用父选择器,只有它们不存在。这是演示页面: http://jsfiddle.net/td7bk/4/ 。
谢谢!
编辑:现在,演示才与Firefox完全兼容,因为它使用-moz-transition和-moz-box-shadow属性以及边框半径属性。
解决方案
This is possible with just css if you are willing/able to adjust your html a tiny bit. I noticed you have a span tag wrapping text in a few li elements but not all of them so i wasn't sure if this was a requirement or not.
See http://jsfiddle.net/td7bk/8/ for an example.
Also, if you're in the mood for a quick tip, take a look at the adjusted css selectors. Simplified and more efficient.
Hope this helps!
不隶属于 StackOverflow