好吧我可以给一些纯CSS的解决方案,但它会是正确的与js做。
这是HTML的一部分
Needs to use full available height.
Automatically generates height from content.
Automatically generates height from content.
Automatically generates height from content.
Automatically generates height from content.
Natural content below
和CSS paert
.container {
position: relative;
}
.clear {
clear: both;
}
.fake-bg {
height: 100%;
position: absolute;
width: 50%;
z-index: -1;
}
.fake-bg:nth-of-type(1) {
background-color: #cff;
left: 0;
top: 0;
}
.fake-bg:nth-of-type(2) {
background-color: #ffc;
right: 0;
top: 0;
}
#e1, #e2 {float: left; width: 50%;}
#e1 {background-color: #cff;}
#e2 {background-color: #ffc;}
#e3 {background-color: #fcf; clear: both;}
一个的jsfiddle例如