Align contents inside a div

后端 未结 8 2012
时光取名叫无心
时光取名叫无心 2020-12-22 15:50

I use css style text-align to align contents inside a container in HTML. This works fine while the content is text or the browser is IE. But otherwise it does not work.

8条回答
  •  一向
    一向 (楼主)
    2020-12-22 16:10

    You can do it like this also:

    HTML

    
        

    CSS

    body { width: 100%; margin: 0; padding: 0; overflow: hidden; }
    
    #wrapper_1 { clear: left; float: left; position: relative; left: 50%; }
    
    #container_1 { display: block; float: left; position: relative; right: 50%; }
    

    As Artem Russakovskii mentioned also, read the original article by Mattew James Taylor for full description.

提交回复
热议问题