Content scrolling on mobile page with fixed header/footer

前端 未结 1 1642
温柔的废话
温柔的废话 2021-01-03 11:05

Hello i am building a mobile webpage where my content only will be scrolling and my footer and header is position:fixed - Can i make the content so that it doesn\'t scroll u

1条回答
  •  独厮守ぢ
    2021-01-03 12:03

    Here you are:

    http://jsfiddle.net/VNVqs/3/

    I just removed the position: absolute to the scrolling part (wrapper and scroll-content), and added some padding to the wrapper in order to let the first and last item not being under header and footer.

    Basically, the trick is done by using position: fixed only on header and footer, and let the rest of the page to scroll as a normal page, without using overflow: auto on a specific fixed-height element. Doing this way, the only problem is that the first lines of your content will be always under the fixed-positioned header (and last ones under the footer), but you can fix this by applying some padding on the content wrapper, as much as header (and footer) height. You got it?

    0 讨论(0)
提交回复
热议问题