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

Home Forums CSS Margin auto Reply To: Margin auto


There’s a few rules to centering a list.

If you give something a fixed width, you can use margin: 0 auto;.

But giving a width limits things a little, so you’ll probably want to give it more flexibility. In that case, you can set text-align:center; on the UL, but you’ll have to make sure that no items within the UL are block-level elements or floated! So make the LI inline elements (or inline-block) and remove the display:block from the links inside the LIs.