How to keep the header static, always on top while scrolling?

前端 未结 8 813
被撕碎了的回忆
被撕碎了的回忆 2020-12-02 08:15

How would I go about keeping my header from scrolling with the rest of the page? I thought about utilizing frame-sets and iframes, jus

8条回答
  •  栀梦
    栀梦 (楼主)
    2020-12-02 09:01

    Instead of working with positioning and padding/margin and without knowing the header's size, there's a way to keep the header fixed by playing with the scroll.

    See the this plunker with a fixed header:

    
    
    
    Header
    Content - very long Content...

    The key here is a mix of height: 100% with overflow.

    See a specific question on removing the scroll from the header here and answer here.

提交回复
热议问题