How can I center align a div without knowing the width?

后端 未结 9 1475
感情败类
感情败类 2021-02-09 18:45

I\'ve looked this up and the outlook seems bleak. I\'m not interested in using a table. I have 6 or so \'a element\' inline-blocks that make up a menu. It\'s slick, except all t

9条回答
  •  滥情空心
    2021-02-09 19:08

    My advice is this answer - however someone commented that it wouldn't work in IE6. Here's how to make this work:

    centered
    #container { text-align: center; } #centeredBlock { margin: 0 auto; text-align: left; width: 50%; }

提交回复
热议问题