position fixed header in html

前端 未结 6 1501
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-01 01:51

I have a header (dynamic height) with a fixed position.

I need to place the container div right below the header. As the header height is dynamic, I can\'t use the

6条回答
  •  时光取名叫无心
    2020-12-01 02:22

    I assume your header is fixed because you want it to stay at the top of the page even when the user scrolls down, but you dont want it covering the container. Setting position: fixed removes the element from the linear layout of the page however, so you would need to either set the top margin of the "next" element to be the same as the height of the header, or (if for whatever reason you don't want to do that), put a placeholder element which takes up space in the page flow, but would appear underneath where the header shows up.

提交回复
热议问题