html css div固定底部

Posted z45281625

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了html css div固定底部相关的知识,希望对你有一定的参考价值。

<div id="father">

  <footer></footer>

</div>

#father

position:relative; //父元素加入相对定位  不加则固定到html底部

footer
position: absolute;  //绝对定位
bottom: 0;
left: 50%;  //水平居中
transform: translate(-50%, 0%); //调整位置

以上是关于html css div固定底部的主要内容,如果未能解决你的问题,请参考以下文章