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