Question: I have a dropdown menu, the background color is the same for all menu items. When I move the mouse pointer over it, each menu item should get and keep a different background color, even if I move over the corresponding submenu items. For example, if I move the mouse pointer over menu item 1, the background is blue and the background of the submenu is also blue when I move the mouse pointer over it. Menu item 2, for example, is then green and menu item 3 is red. Is this possible and if so, can I get a css hint?
Hi Shahin, thank you very much for the quick reply! Unfortunately it doesn’t work. If I assign the class to a top-level menu item, nothing changes, if I assign the class to a sub-menu item, the background color of the sub-menu item changes accordingly. The same if I assign the class to top- and sub-menu item. What am I doing wrong? Any ideas?
You didn’t mention in your first message that you needed it for the top-level menu, so I didn’t include CSS for that in the example. The CSS above was just an example, you’ll need to write your own (but the method is the same as I explained above and you just need to find the correct CSS selector). The theme itself doesn’t include such a feature. Depending on the type of header you are using, the CSS may vary. Generally, you should assign a custom class like menu-color-red to the top-level menu item and then write CSS like the following:
Hello Shahin, fabulous, that works exactly as I wanted it to, thank you very much! Your theme is great and I recommend it to anyone who asks me! Have a great day and all the best! Volker
I still have a problem that I can’t solve – I’m sure it’s just a small thing for you:
When I leave a top-level menu item, the background colour remains the same, but the font color changes back to the standard link color (customizer setting). But I would like the link to keep the color it had when hovering. is that possible? If not, I have to choose other background colors.
You need to write the CSS for it yourself in those custom classes; such an option does not exist in the theme. The CSS should apply on hover and then affect the link as well, like in this method:
.menu-color-red a {
color: #fff !important;
}
Also, for hover:
.menu-color-red:hover a {
color: #fff !important;
}
Note: You should make sure to write the CSS specifically for the menu. If it’s too general, it might affect other areas of the site as well.
Hi Shahin, that was quick, thank you very much! Unfortunately it doesn’t work yet or I’m too stupid. If I use
.menu-color-red a { color: #fff !important; }
the top-level-item is white, even without hover. Without this css statement the top-level-item is visible and the hover-effect works, but then the sub-level-item is white and only appears on hover when the background is faded in. Do you have any other ideas? Bye Volker
You are customizing it, and unfortunately, customization is not part of support. The CSS examples given are just clue to help you build what you want.
Use these selectore for “#site-navigation-wrap .dropdown-menu>li” for main and top level menu and use this one “.dropdown-menu li .sub-menu li.menu-item” for sub menus: https://ibb.co/QFGW99tC.