Wrap the sub-menu into another div, so we can use margin-top on it

Hello. I’m having a challenge adding a margin-top to the sub-menu dropdown, because once I add the margin-top, the empty space causes the dropdown to disappear as you move the cursor through it.

As a solution, we’d need the sub-menu wrapped with a div. Once we have that, when you push the sub-menu down with margin-top, it gets pushed within the wrapper div, and the dropdown will not disappear once we move the cursor over the gap we created.

Hope this was clear enough!

Thanks!

Push…

Is there any quick solution for this?

I want to control the top margin of sub-menus…

If u wanna space it away from the navbar, an empty pseudo element helps as very roughly outlined here WIP: 1.8 Mega Menu Not Staying Up if I Have to Reposition it - #2 by manc

Another (kinda hacky and dirty solution) is to use a gradient for the background of the submenu with the stops set so the first 10px or whatever are transparent,at that same spot the next color would start.

1 Like