Search code examples
htmlcssdrop-down-menusubmenu

css positioning dropdown submenu


In my website there are css sub menus. Problem is last two sub menus gets out from the screen.

enter image description here

How can I maintain position of this sub menus?

There are some minor css tweak & code is so lengthy so I am not posting entire code here. Here is the link of live site which has the problem www.brandstik.in


Solution

  • You need to target your last 2 or 3 menu-links to manage their sub-menu positions as:

    CSS:

    .main-category-nav > li:nth-last-child(1) ul.super-child, 
    .main-category-nav > li:nth-last-child(2) ul.super-child, 
    .main-category-nav > li:nth-last-child(3) ul.super-child {
        right: 0;
    }
    

    This will change sub-menu positions of your last 3 children links.