Home › Forums › CSS › Margin auto › Reply To: Margin auto
August 27, 2013 at 4:07 pm
#148287
Senff
Participant
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 LI
s.