I've a header div
and a menu ul
below it. I'd like to accomplish 2 things:
1) the ul
should have the same width as the div
(outer vertical borders exactly same x position
2) I'd like to keep the spacing between li
elements roughly equal
With some trial and error on the li
's margins and padding I roughly achieved the first point in Google Chrome (please see this jsfiddle) but in Firefox the li
's don't fit in the ul
so they don't stay on a single line. Also, the last li
tends to 'spill over' to a second line when zooming in/out.
I tried it with margin:5px auto
and padding:5px auto
on the li
elements but here auto
seems to mean zero.
Is this really difficult/impossible or am I overlooking something obvious?
I also tried width:fit-contents
but that didn't help either.