I have a menu (left navigation) which has sub menus that fly out when hovered over. It is comprised of unordered lists stacked like so:
<ul>
<li>Item</li>
<li>Item w/ Sub
<ul class="sub">
<li>sub 1</li>
</ul>
</li>
<ul>
This is really its most simple form. Right now the hovering works fine, what I would like to do is to make the vertical centers of the parent menu and the fly-out submenu line up. This image demonstrates the idea:
Current State
Desired State
As you see in the image, the vertical centers (the line spanning halfway up the height of the elements), is basically in line with each.
Right now, the green child is absolutely positioned, but when I add relative positioning to the parent child, it starts to exhibit some erratic and bizarre behavior. I was wondering if there was a way to do this with flexbox, but I have yet to find a solution.
How can I get the vertical centers of a parent and child to align?
Things to consider:
- The submenus are variable height
- They are fixed width (260px)
- The parent menu (blue box) is a fixed height.