在靈活的固定位置容器內實現固定頁眉/頁腳和可滾動區域的最簡潔方法是什麼? (實施例:http://cl.ly/image/293F0f3D1R2B)固定頁眉,頁腳位於靈活的固定位置容器內
假設容器的CSS是類似於:
#modal {
position: fixed;
top: 10px;
bottom: 10px;
left: 10px;
right: 10px;
}
在靈活的固定位置容器內實現固定頁眉/頁腳和可滾動區域的最簡潔方法是什麼? (實施例:http://cl.ly/image/293F0f3D1R2B)固定頁眉,頁腳位於靈活的固定位置容器內
假設容器的CSS是類似於:
#modal {
position: fixed;
top: 10px;
bottom: 10px;
left: 10px;
right: 10px;
}
我用position: absolute;
而不是固定雖然。
繼續爲此可能需要類似的任何人。
我發現的最簡單的僅限於CSS的方法是將可滾動區域絕對放置在絕對容器中,並設置top
和bottom
屬性,使其伸展以填充可用區域。 (爲此,您需要知道頁眉和頁腳的高度。)
工作示例+演示此處:http://codepen.io/stuntbox/pen/lEdpq