2014-03-25 34 views
0

我试图让页脚包装高度扩大到匹配它的孩子,但即时通讯没有运气。有关我如何实现这一目标的任何想法?不能让孩子高自动调整到父母

<div id="footer"> 
    <div id="footer-wrapper"> 
     <div style="float:left; width:160px"> 
    <strong>TITLE</strong><br/> 
     <a href="#">links</a><br/> 
     <a href="#">links</a><br/> 
      <a href="#">links</a><br/> 
    </div> 

     <div style="float:left; width:160px"> 
    <strong>TITLE</strong><br/> 
     <a href="#">links</a><br/> 
     <a href="#">links</a><br/> 
      <a href="#">links</a><br/> 
    </div> 
    </div> 
</div> 


#footer { 
    width: 100%; 
    background: transparent url(../images/bgfooter.jpg) no-repeat top center; 
    background-color: #363732; 
    border-top: 5px solid #2c2d29; 
    clear: both;/*Clears all columns and sets the footer at the bottom*/ 
} 

/*--Set footer width and center--*/ 
#footer-wrapper { 
    color: #9c9b9a; 
    width:800px; 
    margin: 0 auto; 
    padding: 10px 0px 10px 0px; 
    height: auto; 
} 

回答

0
<div id="footer-wrapper"> 

<div style="float:left; width:160px"> 
<strong>TITLE</strong><br/> 
<a href="#">links</a><br/> 
<a href="#">links</a><br/> 
<a href="#">links</a><br/> 
</div> 

<div style="float:left; width:160px"> 
<strong>TITLE</strong><br/> 
<a href="#">links</a><br/> 
<a href="#">links</a><br/> 
<a href="#">links</a><br/> 
</div> 

<div class="clear"></div> 
</div> 
<style> 

#footer { 
    width: 100%; 
    background: transparent url(../images/bgfooter.jpg) no-repeat top center; 
    background-color: #363732; 
    border-top: 5px solid #2c2d29; 
    clear: both;/*Clears all columns and sets the footer at the bottom*/ 
} 

/*--Set footer width and center--*/ 
#footer-wrapper { 
    color: #9c9b9a; 
    width:800px; 
    margin: 0 auto; 
    padding: 10px 0px 10px 0px; 
    height: auto; 
} 

.clear 
{ 
    clear: both; 
} 

</style> 

请使用此代码

+0

作为测试显示,当我添加不同的背景颜色,以脚注的方式包装,而不是补到孩子们的身高只是从上往下填充约10px。 – Ruf1

+0

,因为您给了页脚包装div的填充20px –

+0

我删除了填充,然后根本不显示背景颜色。 – Ruf1

0

这里是更新CSS。我添加了一个背景色页脚包装作为测试显示的DIV高度,但它并没有在所有

#footer { 
    width: 100%; 
    background: transparent url(../images/bgfooter.jpg) no-repeat top center; 
    background-color: #363732; 
    border-top: 5px solid #2c2d29; 
    clear: both;/*Clears all columns and sets the footer at the bottom*/ 

} 

/*--Set footer width and center--*/ 
#footer-wrapper { 
    color: #9c9b9a; 
    width:800px; 
    margin: 0 auto; 
    padding: 0px 0px 0px 0px; 
    height: auto; 
    background-color:#666666; 


} 
相关问题