[data-submenu] { position: relative; } // drop-down .animated-submenu > .sub-menu { position: absolute; z-index: 10; top: var(--top, 100%); margin-top: var(--margin-top, 15px); min-width: 100px; border-radius: var(--border-radius); width: var(--width, 200px); background: var(--background-color); box-shadow: var(--boxShadow); // drop-down bridge &:before { position: absolute; content: ''; top: 0; left: 0; width: 100%; height: var(--margin-top, 15px); transform: translateY(-100%); } } // first drop-down .menu > [data-submenu='right'] > .sub-menu { left: 0; } .menu > [data-submenu='left'] > .sub-menu { right: 0; } [data-submenu] .menu-item:not([data-submenu]) { > ul { position: fixed; } } // other drop-downs .animated-submenu [data-submenu] > ul { --top: 0; margin-top: 0; &:before { width: 5px; height: 100%; transform: initial; } } .animated-submenu [data-submenu='right'] { > ul { right: -5px; margin-right: -100%; &:before { left: -5px; right: initial; } } } .animated-submenu [data-submenu='left'] { > ul { left: -5px; margin-left: -100%; &:before { left: initial; right: -5px; } } } // child indicator .child-indicator { margin-left: 5px; svg { fill: currentColor; } } .animated-submenu > a { justify-content: space-between; } .animated-submenu [data-submenu='left'] > a { .child-indicator svg { transform: rotate(90deg); } } .animated-submenu [data-submenu='right'] > a { .child-indicator svg { transform: rotate(-90deg); } }