我不确定为什么 contactBox 与 mainInfo 框重叠。联系人框也没有拉伸(stretch)到其 960px 的父容器。
CSS
.mainInfo {
position:relative;
height:500px;
background-color: pink;
padding:30px 0 0 30px;
}
.col-6 .imagePlaceholder {
width:300px;
height:420px;
background-color: red;
}
.col-6 .about {
position: absolute;
top:30px;
left:414px;
padding:1em;
}
.contactBox {
height:450px;
background-color:green;
}
这是一个 JS fiddle : http://jsfiddle.net/2zm47/
最佳答案
我可能会以不同的方式编写此 css,但请检查
.mainInfo {
position:relative;
height:500px;
background-color: pink;
padding:30px 0 0 30px;
}
.col-6 .imagePlaceholder {
width:300px;
height:420px;
background-color: red;
}
.col-6 .about {
position: absolute;
top:30px;
left:414px;
padding:1em;
}
.contactBox {
height:450px;
background-color:green;
}
希望对您有所帮助。我在 fiddle 的 JS 部分做了一个注释。
关于html - child 不向 parent 拉伸(stretch),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23096558/