简体   繁体   English

为什么CSS悬停效果不起作用?

[英]Why the CSS hover effect is not working?

I have this page: 我有这个页面:

link 链接

If you click on "products", will open a submenu. 如果单击“产品”,将打开一个子菜单。 I want to add a hover effect to this submenu . 我想在此子菜单中添加一个悬停效果。

I tried this code but do not understand why not go? 我试过这段代码,但不明白为什么不去? I missed something? 我错过了什么吗?

.sub-menu li:hover{color:red'}

It certainly is probably something simple but I can't realize where is the problem. 当然,这可能很简单,但我不知道问题出在哪里。

You can help me solve this problem? 您可以帮我解决这个问题吗?

Thanks in advance! 提前致谢!

The color of the submenu items is controlled by 子菜单项的颜色由

#menu-main-menu .sub-menu li a {
    color: #ddd;
}

so you would need 所以你需要

#menu-main-menu .sub-menu li a:hover {
    color: red; /* or whatever color you wish */
}

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

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