Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我尝试突出显示“母亲”菜单项
这是CSS
.current-menu-item { background-color: red; background-image: none; }
它适用于菜单项,但我不想要精确的项目,只是母亲
菜单示例
一个的两个和三个子菜单...我喜欢在任何选择两个或三个时突出显示一个
您将无法选择元素的父元素。
CSS中不存在跟随选择器......然而:
:parent /* DON'T EXISTS! */
你只能用 JavaScript 做到这一点。