absolute之整体布局实现
要实现如图的布局,我最先想到是将header与footer绝对定位,但是发现在移动端会出现bug,经查资料发现用absolute实现整体布局非常好,还挺简单的。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | .header, .footer, .content {
position : absolute ;
left : 0 ;
right : 0 ;
}.header {
height : 48px ;
top : 0 ;
z-index : 1 ;
}.footer {
height : 52px ;
bottom : 0 ;
z-index : 1 ;
}.content {
top : 48px ;
bottom : 53px ;
overflow : auto ;
}
|