Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums CSS Centering a nav element in a div. Re: Centering a nav element in a div.

#119377
AaronCDR
Participant

This wouldn’t be what you’re trying to achieve by chance?

http://codepen.io/AaronCDR/pen/KbJyG

If you haven’t defined a width on the menu, setting it to `display: table;` with `margin: 0 auto;` should centre it within the parent element.

Edit – just noticed you have defined a width, in which case @David_Leitch is correct with `display: block;`.