Div创建滚动条

Dem*_*nes 2 html css

http://jsfiddle.net/yDx55/

最后一个div应该是100%的高度,但我希望它只显示到页面的末尾,而不是创建滚动条的那个.当div内的数据超出div的末尾时,我希望它能扩展,但如果内容很少则不会.

|xx    |
|xx    |
|______|
Run Code Online (Sandbox Code Playgroud)

当没有很多内容时,我就是这么想的.

但是当内容很多时,我希望它如下:

|xx     |
|xx     |
|xx     |
|xx_____| << The point where if the content exceeds this, then a scroll bar comes up
|xx     |
|xx     |
|_______|
Run Code Online (Sandbox Code Playgroud)

所以基本上,如果div中的内容穿过其他页面,滚动条应该出现,滚动条不应该出现.

请帮忙

My *_*rts 5

假设你总是知道前两个元素的高度(在你的例子中就是这样),你可以将最后一个元素绝对放在页面的底部,overflow: auto以便在neccessery时提供滚动条:

#last_div {
    position: absolute;
    top: 187px;
    bottom: 0;
    overflow: auto;
}
Run Code Online (Sandbox Code Playgroud)

JSFiddle:http://jsfiddle.net/yDx55/2/