我不確定DIV
的屬性是完全清楚的。請注意,這還不是一個答案,只是太長時間纔會發表評論。
http://jsfiddle.net/V8yuN/
現在,如果你想DIV#content
在第一佔用整個高度,但隨後縮減爲DIV#list UL
增長,又是什麼您想與DIV#content
完成?請注意,我將UL
置於DIV
之內。
現在,上述小提琴以某種方式演示了您所描述的內容(DIV#content
被推到底部)。我的問題是,你的設計中DIV#content
的height
是什麼?
編輯
請注意,如果您的#container
overflow: hidden
,使#content
的height: 100%
,那就彷彿#container
萎縮出現。
#container {
height: 100px;
background: grey;
overflow: hidden;
}
#list {
max-height: 70px;
overflow: auto;
background: #ddf;
}
#content {
height: 100%;
background: #fdf;
}
http://jsfiddle.net/V8yuN/2
我不知道,不過,如果這會導致你的設計打破,如果#content
的實際內容需要顯示(例如,如果它是動態變化的)。
EDIT 2
下完成的一切,但#content
文字的vertical-align
:
HTML
<div id="container">
<div id="push">
<div id="list">
<ul></ul>
</div>
<div id="content">
<div class="border-top"></div>
<div id="content-inner">
<span>TEST CONTENT</span>
</div>
</div>
</div>
<div class="border-bottom"></div>
</div>
CSS
#container {
height: 100px;
background: grey;
}
#push {
height: 95px;
overflow: hidden;
}
#list {
max-height: 70px;
overflow: auto;
background: #ddf;
}
#content-inner {
min-height: 100px;
background: #dfd;
margin: 0;
border-left: 5px solid #fdf;
border-right: 5px solid #fdf;
}
.border-top {
background: #fdf;
border-radius: 5px 5px 0 0;
height: 5px;
}
.border-bottom {
background: #fdf;
border-radius: 0 0 5px 5px;
height: 5px;
}
http://jsfiddle.net/V8yuN/6/
你可以發佈你已經嘗試過也許還包括http://jsfiddle.net演示的鏈接)? –
只是爲了澄清:ul和div是同一個固定高度塊的孩子,不是彼此的孩子,ul +的最大高度+ div的高度=父母的固定高度? – approxiblue
@JimmyX是的,這是正確的 – dragoon