After some search, I did not find a proper way to center a list of <li>
into a fixed width div
.
Take a look at the page.. It doesn't work either!
After some search, I did not find a proper way to center a list of <li>
into a fixed width div
.
Take a look at the page.. It doesn't work either!
use oldschool center-tags
:-)
Here is the solution I could find:
If you know the width of the
ul
then you can simply set the margin of theul
to0 auto;
This will align the
ul
in the middle of the containing divExample:
HTML:
CSS:
Try
To center a block object (e.g. the
ul
) you need to set a width on it and then you can set that objects left and right margins to auto.To center the inline content of block object (e.g. the inline content of
li
) you can set the css propertytext-align: center;
.