我无法使用 CSS 让我的网站以我的生活为中心。我已经尝试了网络上建议的所有常用方法,包括:
body {
text-align: center;
}
#container {
width: 770px;
margin: 0 auto;
text-align: left;
}
然后使用
<div id="container>
<!-- Centered Content Goes here-->
</div>
但它只是不会去中心。它停留在页面的左侧。
我想要居中的元素的 CSS 示例如下:
#topHeader
{
background:url(images/top_header.jpg);
position:absolute;
width: 695px;
height: 242px;
top: 0px;
left: 0px;
}
所以,我的 HTML 看起来像这样:
<div id="container>
<div id="topHeader></div>
<!-- All other elements go here as well-->
</div>
但正如我之前提到的,元素保持不变。谢谢!埃里克