2012-07-31 78 views
-1

我已经在这里看到在没有成功计算器几个答案扩展,所以让我发表我的链接在这里:孩子DIV不与内容

http://www.copycopy.it/index.php?go=how

在此页面,例如,白色的div(# body_content_container)应该随内容一起扩展,但它不会。本页同样适用:http://www.copycopy.it/index.php?go=termsAndConditions

任何想法我在这里做错了吗?我已经尝试clear:both;对孩子divs,但没有运气。

+2

发布您的代码,请。 – 2012-07-31 16:02:33

+0

对不起,我没有点击来自未知网站的随机链接。你能提供更多的细节,还是在http://jsfiddle.com上复制问题? – freefaller 2012-07-31 16:16:52

+0

如果你面临的问题,请把代码,然后只有其他人可以帮助你 – Prashobh 2012-07-31 16:48:52

回答

0

尝试移除高度:100%;从你的元素。如果您希望它扩展到内容的长度,则不需要指定高度。此外,它只会扩展到窗口的长度。

+0

解决问题!谢谢Kwon! – 2012-08-01 06:26:56

0
  1. #content_text删除height: 85%;
  2. position:absolute;position:relative;同时替换为float:left;
  3. margin替换任何topleftpadding

例如:

#columnHeader { 
    float: left; 
    text-align: center; 
    width: 940px; 
} 

#column1 { 
    float: left; 
    margin: 0 10px 0 0; 
    text-align: justify; 
    width: 285px; 
} 

#column2 { 
    float: left; 
    margin: 0 0 0 40px; 
    text-align: justify; 
    width: 275px; 
} 

#column3 { 
    float: left; 
    margin: 0 0 0 10px; 
    text-align: justify; 
    width: 320px; 
}