CSS sprite 不只粘在主导航上?

发布于 2024-08-22 00:16:58 字数 212 浏览 0 评论 0原文

请参阅 http://bldd.nl/prototypes/megamenu/test23.php

我是坚持这一点,如果您滚动子菜单导航,您会看到相应的主菜单滚动精灵吗?

我该如何解决这个问题并优化CSS?

See http://bldd.nl/prototypes/megamenu/test23.php

I am stuck with this, if you rollover the submenu navigation you see the corresponding mainmenu rollover sprite?

How can i fix this and optimize the css?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清风疏影 2024-08-29 00:16:58

您的 CSS 使用后代选择器:#jobs-news a:hover

这将匹配 #jobs-news 内的任何 a:hover,即使它实际上位于其子级之一中。

最简单的解决方案是为根 a 元素提供自己的类(例如 ),然后更改将悬停选择器设置为 #jobs-news a.MainLink:hover

这样,它就不会匹配子项,因为它们没有 MainLink 类。

如果您不需要支持 IE6,您还可以使用子选择器:#jobs-news > a:悬停

Your CSS uses a descendant selector: #jobs-news a:hover.

This will match any a:hover inside of #jobs-news, even if it's actually in one of its children.

The simplest solution would be to give the root a elements their own class (eg, <a class="MainLink" href="#">), then change the hover selectors to #jobs-news a.MainLink:hover.

This way, it wouldn't match the subitems, since they wouldn't have the MainLink class.

If you don't need to support IE6, you could also use a child selector: #jobs-news > a:hover

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文