2015-11-04 100 views
0

我有一個應用程序使用粘性頁腳,但是,我有一個約束,需要一個內容容器跨越其父母的100%有一個最小高度:100%定義。在這個簡化的示例中,inner是內容容器,並且換頁是父級。最小高度:粘性頁腳需要100%才能正常運行。使子元素填充100%的父母的最小高度設置爲100%

<div class="page-wrap"> 
    <div class=inner> 
    <h1>.inner</h1> 
    <button id="add">Add Content</button> 
    </div> 
</div> 

<footer class="site-footer"> 
    <h1>.site-footer</h1> 
</footer> 

請看小提琴的例子。

http://codepen.io/TroutZen/pen/OywGWg

回答

0

可以嘗試使用這樣的:

.inner { 
    width: 100%; 
    background-color: green; 
    top: 0; 
    bottom: 142px; 
    position: absolute; 
} 

Example

+0

這並不能完全解決,雖然手頭上的問題,可以添加一個'溢出:汽車;' 是的頁腳應該始終可見? – segFault

+0

約束:1)當內容<100%時,頁腳必須在底部可見2)內容背景必須伸展以符合頁腳2)當內容擴展超過100%視口時腳註被壓下 – DevOtts

相關問題