CSS Sticky Header/Footer and Fully Stretched Middle Area?

后端 未结 3 1395
温柔的废话
温柔的废话 2020-12-14 11:56

With CSS, how can i simply get a page with sticky header and footer which are appearing forever, whenever the page is scrolling or not. I found som

3条回答
  •  渐次进展
    2020-12-14 12:36

    Can use absolute position for all 3 elements.

    #header,#footer,#content { position:absolute; right:0;left:0}
    
    #header{
       height:100px; top:0;
    }
    #footer{
      height:100px; bottom:0;
    }
    #content{
      top:100px;
      bottom:100px;
      overflow:hidden; /* use this if don't want any window scrollbars and use an inner element for scrolling*/
    }
    

    DEMO: http://jsfiddle.net/RkX8B/

提交回复
热议问题