我想制作一个背景固定的网站(我已经有了),在背景前面中间是我的东西,比如这个网站:http://www.nexusmods.com/skyrim/ ?我搜索了整个互联网,但找不到任何东西。我已经在源代码中搜索过。有人能帮我吗?抱歉我的英语不好,我是瑞士人。请随时纠正我。
最佳答案
您正在寻找的是设置主要内容的固定宽度,然后为左右设置自动边距以使其居中。
.content {
width:600px; //set your desire width here
background-color:#ffffaa; // color is just there to visualize
margin-left:auto;
margin-right:auto;
}
在您的 HTML 中:
<body>
<!-- header -->
<!-- main content -->
<div class="content">
This is the main content box
</div>
<!-- footer -->
</body>
希望这会有所帮助。
注册,
颜
关于HTML:在中间做一列,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23709740/