Latest Lists

how to center the UL (unordered list) in a html page using div?

sometimes, i want to use center the UL list in a html page so , i can set the menu center of the page. I see the UL is always left aligned or right aligned. thanks for the help in advance Well, i got the right answer at http://css.maxdesign.com.au/listamatic/horizontal19.htm this is exactly i was expecting for, Thanks for the replies

Public Comments

  1. Hmm... try this: <div align="center"> <ul> <li></li> <li></li> <li></li> <li></li> </ul> </div>
  2. The above approach works OK but it will allign all the list entries centered which may not be what you are looking for in case some of them are longer then the others. The code below is another approach. (I know you aren't supposed to use tables for layout as a rule but I am not sure how to get the same effect using divs) <table align="center"> <tr> <td> <ul> <li>item 1</li> <li>item 2</li> <li>item 3</li> <li>item 4 - this one is longer</li> </ul> </td> </tr> </table>
Powered by Yahoo! Answers