我在这里是因为其他类似的问题对我的特定问题没有帮助。
我需要right div
一直保持 100% 的高度,parent
高度取决于left div
高度,高度取决于内部的内容。
这是html:
<div class="container clearfix">
<div class="left"></div>
<div class="right"></div>
</div>
这是CSS:
.container{
min-height: 10px;
width: auto;
height: auto;
background-color: #eeeeee;
}
.left{
position: relative;
float: left;
min-height: 100px;
width: 50px;
background-color: #dddddd;
}
.right{
min-height: 20px;
position: relative;
float: left;
height: 100%;
width: 50px;
background-color: #dddddd;
}
.
.clearfix:after
{
content: ".";
display: block;
clear: both;
visibility: hidden;
line-height: 0;
height: 0;
}
.clearfix {
display: inline-block;
}
注:
我正在使用clearfix
.
如果你能在jsfiddle
这是 jsFiddle http://jsfiddle.net/C9Kmx/32/