I'm having a small problem centering a submenu from a dropdown menu. The following example is fairly simple, but it illustrates my problem well:
<ul id="menu">
<li>Menu1
<li>Menu2
<ul>
<li>Submenu1
<li>Submenu2
<li>Submenu3 com outras palavras
<li>Submenu4
</ul>
<li>Menu3
</ul>
Preview JSFiddle . What happens is as follows: The red submenu (within the second UL) is centered on the parent menu, Menu2 . However, I do not know if it is correct since I had to adjust the left position of the submenu UL (50%) and LI (-50%).
Everything was centralized, regardless of the text size of the menus, but with a problem: bg green shows that the submenu UL is still in the "wrong position", but only so I can centralize perfectly since I did not want to stipulate a width (in pixels) for the submenus.
Is it possible to centralize everything, including the UL sumbenu?