也許下面是一些東西,符合您的要求: http://jsfiddle.net/N6FfW/1/
HTML
<div id='left'>
</div>
<div id='wrapper'>
<div id='top'>
</div>
<div id='bottomwrapper'>
<div id='bottom'>
</div>
</div>
</div>
有關CSS
/*box-sizing has to be added because we set a padding for #left and #bottom
which then would be bigger than they should. (It includes padding
and border into the height and width)*/
#left, #bottom {
box-sizing:border-box;
}
#left {
float:left;
background-color:red;
width:200px;
height:100%;
}
/*Overflow:hidden establishes a new Block Formatting Context for the
wrapper, which will prevent #left from intruding into it*/
#wrapper {
overflow-y:auto;
height:100%;
}
/*The following creates an invisible floated box with full height in the #wrapper*/
#wrapper:before {
height:100%;
float:left;
content:'';
}
#top {
background-color:blue;
min-height:200px;
}
/*Position has to be set to relative, so that the contained box
#bottom can expand to full height and width of this wrapper
with height:100% and width:100%. We have to use a wrapper because
we can't set overflow-x:auto to this wrapper directly: This would
cause a new BFC to be established and the previously defined
left-floated box couldnt affect the layout of this box anymore,
it wouldnt expand to full height.*/
#bottomwrapper {
position:relative;
}
/*Creates an invisible box at the end of #bottomwrapper, which
will be shifted downwards until it reaches the end of the
previously defined float:left box (clear:both is responsible
for that). This expands #bottomwrapper to full height, because
it will contain this invisible box in any case.*/
#bottomwrapper:after {
content: '';
display:block;
clear:both;
}
/*Position:absolute is used so that #bottom can be expanded to full height
and width of its parent container #bottomwrapper.*/
#bottom {
position:absolute;
height:100%;
min-height:200px;
width:100%;
background-color:green;
overflow-x:auto;
white-space: nowrap;
}
我不主張這是最好的解決方案爲您的用例,但儘可能我測試過了,它運行良好。
有關塊格式化的更多信息上下文:How does the CSS Block Formatting Context work?
這個特殊的解決方案不會通過垂直滾動來滾動標題部分,但是這個解決方案對我來說很有用。謝謝。 – OrangeKing89
很高興我能幫到你,但是通過滾動標題部分你是什麼意思? –