Menu navigation bar which contains floated elements.

Note that floated elements have no width specified and this is what makes centering the navigation bar tricky.

Horizontal centering using CSS fit-content value

Note the navigation bar is now centered, no matter the width of the contained floated elements.
Current support: Chrome and Firefox.

Back to article / Follow me on Twitter!