CSS Sticky footer完美底部布局

html 结构:

<div class="container">
    <div class="content-wrapper>
       <div class="content">内容区域,可随机长度</div>
    </div>
    <div class="close">
<div>

<div class ="close">关闭图标</div>始终再底部.

css代码:

.container{//总容器为全屏,所以高度为100%
  positon: fiexd;//固定窗口,显示在最前
  top:0;
  left:0;
  height:100%;
  width:100%;
  overflow: auto;//如果内容太长,会显示滚动条查看其余内容。
 }
.content-wrapper{
  min-height: 100%;//如果内容不够长时,也保证内容有全屏长度
}
.content{
  margin-top: 50px;//向上和屏幕顶部保持50px间距
  padding-bottom: 50px;//保证内容content区域的底部有50px的空白
}
.close{
   position: relative
    width: 32px;
    height: 32px;
    margin: -50px auto 0 auto;  //让关闭按钮向content-wrapper里面伸入50px,正好把内容区的50px空白补上
    clear: both;
    font-size: 32px;

}

最终效果:

在这里插入图片描述

更多关于Sticky footer布局的知识请参考另一篇文章 CSS :Sticky footer