我有很多父容器。在頁面上有很多這樣的實例。 他們有不同的高度。固定父容器高度,子展開/被限制到父容器
這是資料覈實的層次:
.parent_container
|-----> .title
|-----> .content
.parent_container有一個固定高度 .title僞佔用一些高度 的我想。內容採取了高度的休息...不佔據.title。
我該怎麼做呢?
目前我有這個,但因爲父容器是不同的高度,90%並不總是工作得很好,因爲.title總是由H2風格指定的特定高度。
有沒有在CSS中說「內容高度= parent_height - 標題高度」的方法?
/*just an example...different parent_containers have diff heights)*/
.parent_container{
height:530px;
}
.content {
height:90%; /* to make room for title */
overflow:auto; /*show scrollbars*/
}
這不適合我。出於某種原因,我的.scroll_container內容超出了.parent_container的界限。 這基本上就是我的CSS。 .parent_container {height:500px; } .content {height:100%;/*父母的100%* /} .scroll_container {overflow:auto; } (對不起...我不知道如何格式化評論) – milesmeow 2010-11-19 15:33:20