我有这样一个div区域:
<div class="con">
<div class="container"></div>
<div class="sidebar"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
和CSS:
.con{
width:100%;
}
.con .container{
width:70%;
min-height:500px;
float:left;
background:#f00;
}
.con .sidebar{
width:30%;
min-height:500px;
float:right;
background:#ccc;
}
Run Code Online (Sandbox Code Playgroud)
在container和sidebar类高度是动态的.当其中一个级别的高度增加时,课程con也必须增加.但我的问题是班级con高度总是0,我似乎无法给con班级一个静态高度.
添加overflow: auto;到.con:
.con {
width: 100%;
overflow: auto;
}
Run Code Online (Sandbox Code Playgroud)