<分区>
<分区>
问题:主要内容和页脚不会以 100% 宽度增长。
CSS 代码;
div.header{width:100%; height:50px;};
div.headercontent{width:980px; margin:0 auto;};
div.maincontent{width:100%;};
div.footer{width:100%; height:50px;}
最佳答案
这对我来说很好:
您可能希望删除每个 CSS 声明后的分号:
body {
margin: 0;
}
div.header {
height: 50px;
background: #b6ff00;
}
div.headercontent {
width: 980px;
margin: 0 auto;
}
div.maincontent {
background: #ff7f27;
}
div.footer {
height: 50px;
background: #000;
color: #fff;
}
我假设您正在使用的 HTML(因为您没有提供任何内容):
<div class="header">
<div class="headercontent">
Header
</div>
</div>
<div class="maincontent">
Main Content
</div>
<div class="footer">
Footer
</div>
关于html - Div 内容宽度(溢出问题),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23009009/