首先,我是不是正在尋找Javascript解決方案。HTML/CSS:兩個塊divs一個滾動和一個父項限制
我還喜歡解決方案不是使用CSS3。如果可能的話(這是爲了支持)
這可以水平完成。如xHTML/CSS: How to make inner div get 100% width minus another div width
我想知道是否有類似的東西可以垂直實現。
我知道,CSS3解決方案可能能夠使用calc();運營商。不過,我正在尋找一個更舊的學校CSS3前的解決方案,所以我可以得到儘可能多的支持。
假設父容器的尺寸是由用戶通過調整大小設置的。
There are two inner divs, one above the other.
- one is as high as its content
- one fills the rest of the height and scrolls if overflows.
滾動容器位於不斷增長的容器上方。
這,解釋說簡單一點:
<div id="parent">
<div id="scroll">
content<br/>content<br/>content<br/>content<br/>content<br/>
content<br/>content<br/>content<br/>content<br/>content<br/>
content<br/>content<br/>content<br/>content<br/>content<br/>
content<br/>content<br/>content<br/>content<br/>content<br/>
content<br/>content<br/>content<br/>content<br/>content
</div>
<div id="grow">
as this content grows,
the above content above gets smaller,
but is scrollable,
</div>
</div>
#parent{
height : user defined in pixels/can randomly change
width : user defined in pixels/can randomly change
}
#grow{
width : as wide as parent
height : as_height_as_contents
}
#scroll{
width : as wide as parent
height : whatever height is remaining
overflow : auto /* scroll if necessary */
}
所以這可能嗎?
downvoter請解釋爲什麼這是downvoted? –