2014-01-13 77 views
0

试图使父母div高度与其包含child-div匹配。使父母div高度符合孩子身高问题

<div id="parent"> 
    <div id="child"> 
     Content goes here 
    </div> 
</div> 

继承人我CSS:

#parent { 
    width: 100%; 
    overflow: auto; 
    background-color: #f3efe7; 
    z-index: 1; 
    position:relative; 
    top: 100px; // I have a header that is 100px in height and set to position: fixed. 
} 

    #child { 
     max-width: 920px; 
     position: relative; 
     margin: 0 auto 0 auto; 
     padding-top: 50px; 
     padding-bottom: 40px; 
     text-align: center; 
     font-family: 'Open Sans', sans-serif; 
     font-size: 14px; 
     line-height:140%; 
    } 

的子内容被裁剪并没有完全显示出来。我究竟做错了什么?

亲切的问候约翰

+1

做工精细http://jsfiddle.net/AKyYL/ – DaniP

+0

同意,它的工作原理http://jsfiddle.net/ – jcho360

+2

//这是不一个CSS评论 - > CSS永远只有:/ *这是一个CSS评论*/ – caramba

回答

0

编辑:发现这是我的页脚makeing问题......因为它ontop的覆盖和覆盖内容的一部分。该页脚CSS中的问题在哪里?我只是不明白什么使问题...

Here's the CSS for that: 

#footer-top { 
    width: 100%; 
    height: 10px; 
    background: #ffffff url('images/header/test4.svg') no-repeat; 
    z-index: 1; 
    position: relative; 
} 

footer { 
    width: 100%; 
    background-color: #f3efe7; 
    z-index: 2; 
    position: relative; 
    background-color: #ffffff; 
}