这是另一种方法。
参考: jsFiddle
这个不是 float
div 而是使用 a#divWrapper
来处理内部#divTop
和#divBottom
需求。
HTML:
<div id="divContent">
<div id="divWrapper">
<div id="divTop">
<p>This is random webpage content for div B. <br />
This is random webpage content for div B. <br />
This is random webpage content for div B. <br />
This is random webpage content for div B. <br />
The 'background-color' aqua is the size of this div B. <br />
<b>Note CSS 'min-height' is optionally used for this div. </b>
</p>
</div>
<div id="divBottom">
<p>The remainder of the space is used by div C. Line 01 <br />
The remainder of the space is used by div C. Line 02 <br />
The remainder of the space is used by div C. Line 03 <br />
The remainder of the space is used by div C. Line 04 <br />
The remainder of the space is used by div C. Line 05 <br />
The remainder of the space is used by div C. Line 06 <br />
The remainder of the space is used by div C. Line 07 <br />
The remainder of the space is used by div C. Line 08 <br />
Since this div is secondary, contents may clip. Line 09 <br />
The remainder of the space is used by div C. Line 10 <br />
The remainder of the space is used by div C. Line 11 <br />
The remainder of the space is used by div C. Line 12 <br />
The remainder of the space is used by div C. Line 13 <br />
The remainder of the space is used by div C. Line 14 <br />
</p>
</div>
</div>
</div>
CSS:
#divContent {
background-color: yellow;
border: 3px solid red;
width:400px;
height: 400px;
}
#divWrapper {
height: 90%;
width: 90%;
top: 5%;
left: 5%;
position: relative;
border: 1px solid black;
overflow: hidden;
}
#divTop {
background-color: aqua;
min-height: 155px; /* Optional minimum height setting */
}
#divBottom {
background-color: pink;
width: 100%;
}
#divTop:hover, #divBottom:hover {
background-color: white;
}