page will not align center

白昼怎懂夜的黑 提交于 2019-12-02 02:25:35

问题


I have got a css problem.

http://www.luukratief-design.nl/dump/parallax/index.html

I cant get this page to align center. Before i get the answer to use "text-align: center;" on the body, i already did.

The page 100% validates (CSS and HTML).

Please help, never had this before.


回答1:


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

#wrapper{
margin:0 auto;
}



回答2:


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




回答3:


add this to you wrapper:

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



回答4:


Use this css to align to center:

<style>
  #your_div_id {margin:0px auto;}
</style>


来源:https://stackoverflow.com/questions/2279295/page-will-not-align-center

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