Align a div to center

后端 未结 14 2124
别跟我提以往
别跟我提以往 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:42

    The usual technique for this is margin:auto

    However, old IE doesn't grok this so one usually adds text-align: center to an outer containing element. You wouldn't think that would work but the same IE's that ignore auto also incorrectly apply the text align center to block level inner elements so things work out.

    And this doesn't actually do a real float.

提交回复
热议问题