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

后端 未结 9 1506
感情败类
感情败类 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:05

    You need to set margin: 0 auto; on the outer container div, add text-align: center; on the inner div; and use an unordered list to build your menu in the first place.

提交回复
热议问题