Align a div to center

后端 未结 14 2125
别跟我提以往
别跟我提以往 2020-12-02 13:20

I want to float a div to center. Is it possible? text-align: center is not working in IE.

14条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-02 13:29

    There is no float to center per se. If you want to center a block element inside another do this:

    Stuff to center

    with:

    #outer { width: 600px; }
    #inner { width: 250px; margin: 0 auto; }
    

    Now that won't make the text wrap around it (like it would with a float left or right) but like I said: there is no float center.

提交回复
热议问题