page will not align center

為{幸葍}努か 提交于 2019-12-02 02:08:43

Set the left and right margins of the #wrapper div to auto

#wrapper{
margin:0 auto;
}

to align a page in the center you can place all the content of the page inside a container div and set these css properties

body
{
    text-align: center; //for ie 6

}
#main_wrapper
{
    text-align: left;
    width: 1000px; //any width you want
    margin: 0 auto;

}

here main wrapper is the div that contains all the content

add this to you wrapper:

margin-left:auto;
margin-right:auto;

Use this css to align to center:

<style>
  #your_div_id {margin:0px auto;}
</style>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!