Archived topic
How to fix Sub menu not showing when mouse is out of menu
12 replies · Started by SEO on July 29, 2021
Hey guys, I want to add some margins on my submenus whenever I hover my mouse, this is the csss that I added. However upon adding this css whenever my mouse move towards the sub menu, the sub menu will go hide. here is my site
https://hrcstaging.wpengine.com/
.main-navigation:not(.toggled) ul li.sfHover>ul, .main-navigation:not(.toggled) ul li:hover>ul {
margin-top: 20px;
}
here is what I want to accomplish in my sub menu gap
https://www.harmonyrecoverync.com/
if you notice there is a slight gap on primary menu and sub menu
Hi there,
Try this:
https://generatepress.com/forums/topic/top-margin-on-sub-menu/#post-864184
its not working
I just tested the code on your site in the developer tool, it's working.
After adding the code, have you cleared the cache?
this is the image of what I want to copy, I want to have a gap on my primary menu and sub menu

Have you added back the CSS you mentioned in your original topic?
https://generatepress.com/forums/topic/how-to-fix-sub-menu-not-showing-when-mouse-is-out-of-menu/#post-1876138
No I removed it
Can you add the CSS back in, leave it there, so we can take a look at whats happening.
I put back the css and it seems working. However when you hover on the submenus it is changing position. is there a solution for this?
Trt change this CSS
.main-navigation:not(.toggled) ul li.sfHover>ul, .main-navigation:not(.toggled) ul li:hover>ul {
margin-top: 20px;
}
to this:
.main-navigation:not(.toggled) .main-nav > ul > li.sfHover>ul, .main-navigation:not(.toggled) .main-nav > ul > li:Hover>ul {
margin-top: 20px;
}
Perfect thank you ying its working now the way it should be
Great! Glad to hear that :)