How to stick
element at the bottom of the page (HTML5 and CSS3)?

后端 未结 4 1288
离开以前
离开以前 2020-12-09 04:16

When I use position relative with no content, footer goes up, with absolute with a lot of content, the footer goes down, and with f

4条回答
  •  清歌不尽
    2020-12-09 04:19

    just set position: fixed to the footer element (instead of relative)

    Jsbin example

    Note that you may need to also set a margin-bottom to the main element at least equal to the height of the footer element (e.g. margin-bottom: 1.5em;) otherwise, in some circustances, the bottom area of the main content could be partially overlapped by your footer

提交回复
热议问题