I have a horizontal scrolling menu with some of the main menu items having a dropdown menu. The problem is if I scroll the main menu the drop down menus do not follow (absolute positioning), or if I make them follow (relative) they push the main menu up.
Absolute:
Relative:
The CSS is:
.navbar {
width:100%;
overflow-x: auto;
overflow-y: hidden;
white-space: nowrap;
}
.dropdown-content {
display: none; //displayed on hover
position: absolute; //or relative
background-color: #f9f9f9;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
Any suggestions as to what I can do to fix this?
What I am looking for is the absolute version - notice the drop down menu drops over the scroll bar, not pushing it down - but with the sub menu properly aligned.
See jsfiddle for example of absolute postioning:

