user1475573 user1475573 - 7 months ago 28
HTML Question

CSS Menu Submenu Issues

I am making a pretty straight forward CSS dropdown style menu and I have followed a variety of online guides in doing so, however for whatever reason the submenus are always lining up with the top of the main menu rather than lining up with the LI it was opened from. I have gone over and over it and am doing the

top:0
and
left:100%
that everyone else is so I can't figure out what's wrong. Any insight would be super appreciate. I have never claimed to be a css master :)
I made a plunker to show what I am doing: https://plnkr.co/edit/NkOAN0b5CVZFQodc5TfK.

Answer

The li should have position: relative to make it the context by which the sub menu is position (plunk):

.navigation ul ul li {
  position: relative;
  line-height: 1.5;
  float:none;
  min-width:200px;
}
Comments