html css div固定底部

<div id="father">

  <footer></footer>

</div>

#father{

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

}

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

posted on 2019-09-02 10:58  马什么梅  阅读(9298)  评论(0编辑  收藏  举报

导航