破坏我的大脑如何伸展整个页面
这就是我想弄清楚的......
答案 0 :(得分:1)
所以你希望页眉和页脚在整个页面上延伸(即屏幕的100%),而内容区域设置为任意数字并居中在页面中间?
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>100% Width of header / footer and still center content</title>
<style type="text/css">
body { margin: 0; }
#header { width: 100%; background: red; }
#content { width: 900px; background: green; margin: 0 auto; }
#footer { width: 100%; background: blue; }
</style>
</head>
<body>
<div id="header">Header Area</div>
<div id="content">Content Area</div>
<div id="footer">Footer Area</div>
</body>
</html>
答案 1 :(得分:0)
body {
margin: 0px
}
.header_wrapper{ width: 100%} //not necessary as it automatically happens
.header{
//make width whatever you want where the content goes
margin-left: auto;
margin-right: auto;
}
这是一般的想法。测试一下。添加颜色等等。
答案 2 :(得分:0)
我希望你这样看: -
<!DOCTYPE html>
<html>
<head>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
#header {
height:100px;
background:red;
}
#mid-content {
background:green;
}
#footer {
height:100px;
background:blue;
}
</style>
</head>
<body>
<div id="header"></div>
<div id="mid-content">Tag info
infonewest 4featured faq votes active unanswered
About cs </div>
<div id="footer"></div>
</body>
</html>
它完全具有100%的宽度......
答案 3 :(得分:0)
我认为只需将文本对齐中心到页脚div