使用内容而不是滚动来扩展DIV

时间:2013-08-02 13:52:53

标签: html css html5 css3 overflow

嘿我正在开发一个网站,我在早期遇到问题我添加了溢出:auto;到我的所有主要类.header .content .footer因为我有一些背景和功能区错误,它已经清理干净了。

但是我最近发现,由于这个属性,.content类有足够的内容滚动而不是继续扩展(我已经尝试过高度:auto;和高度:100%;)如果我禁用overflow:auto;内容继续在我的.footer之上,我的丝带和背景也搞砸了。

我不确定我是否可以强制div扩展或者我是否必须重新编写所有CSS?

这不是一个大问题,网页仍然可以滚动功能,但肯定有一个解决方法。

}

.Header
{
width:  100%;
overflow: auto;
padding-top: 80px;
background: rgb(45, 55, 60);
}

.Content
{
width:  100%;
overflow: auto;
padding-top: 50px;
background: rgb(255, 250, 240);
}

 .Footer
{
width:  100%;
overflow: auto;
padding-top: 30px;
background: rgb(250, 250, 250);
}

这也可能是我想的内容,但我真的不知所措,过去4个小时一直在寻找发帖可能是明智的。

1 个答案:

答案 0 :(得分:2)

从您的所有课程中删除overflow: auto;。他们应该自己扩展内部的内容。

http://jsfiddle.net/BGLMJ/4/

相关问题