2

I have an unordered list and I want to have it in the middle of the page.

By that, I mean that the left side bullets should be vertically aligned with the center of the list item with the longest text, but in the center of the page?

  • item 1 is boring
  • item 2 is a very long item indeed, oh yes it is <=== middle char should be in center of page
  • item 3 is almost as boring as item 1

and not

 
                 * item 1 is boring
    * item 2 is a very long item indeed, oh yes it is
           * item 3 is almost as boring as item 1
Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551

1 Answers1

3

Here is an answer for you which centers your list with variable width: jsfiddle. It's pure css and doesn't add any extra tags.

The method was first published here, and should work in just about all browsers.

mqchen
  • 4,195
  • 1
  • 22
  • 21
  • Errm, aplogies, but not the answer ... yet. I will award the answer when I can extrapolate it to a drop down manu. I found a few examples which work with menus with no drop-down, but i need it. – Mawg says reinstate Monica Feb 28 '11 at 13:50
  • Could you give any more info (maybe even code) on how this dropdown is implemented? Is the list supposed to be the dropdown? – mqchen Feb 28 '11 at 13:52