如何正确对齐Div?

时间:2012-10-30 02:52:55

标签: html css

我无法正确居中my website

当我缩小时似乎居中。但对于不缩小的用户来说,它看起来不合适。有什么建议?该网站是使用所有AP div创建的,即使在尝试使用以下内容时它也无法正确居中:

<div align="center">

3 个答案:

答案 0 :(得分:5)

尝试 margin:0 auto; 作为容器div,它将居中对齐你的div:)

<强> See the example

<强> See the fullscreen view of the result

答案 1 :(得分:-1)

我认为你的设计不正确。你必须:

<body>
<div id="wrapper">
<div id="header">
from apdiv1 to 31
</div>
<div id="content">*/instead of blockquote*/
put content
</div>
<div id="footer">
put content</div>
</div>
</body>

用css body {background-image:concrete bkg.jpg}

#wrapper{margin:0 auto}

更多更多...... brgds

答案 2 :(得分:-1)

在css中

添加属性

body
{
 text-align:center;
 margin:0 auto;
}