[英]Vertically fixed header and footer, scrollable content, horizontally centered
[英]How do you stretch header, content & footer color across a page with everything being centered in a fixed width?
我有标题和主页内容颜色来拉伸整个页面,但内容仍居中。
但是我的页脚未拉伸,如何像页眉一样拉伸页脚?
HTML:
<body>
<div id="header">
<div class="container"> <img src= "images/webalign-uk-white.png" width="429" height="61" />
<!-- header's content here --><p class="fltrt">Contact: 00000000000</p></div>
<!-- .container -->
</div><!-- #header -->
<div id="content">
<div class="container">
<!-- main content here --><h1> Hello!</h1>
<div id="footer">
<div class="container">
<!-- footer's content here --><p>Footer1</p>
</div><!-- .container -->
</div><!-- #footer -->
</body>
CSS:
.container {
width: 960px;
margin: 0 auto;
overflow: hidden;
padding: 0 15px; /* the auto value on the sides, coupled with the width, centers the layout */
}
#header {
background-color: #eee;
}
#content {
padding: 10px 0;
background-color:#F9f9f9;
}
#footer {
padding: 10px 0;
background-color: #333;
color: #bbb;
clear: both;
}
您没有关闭.container
和#content
div。 这可能是问题所在。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.