将一个div固定在页脚

<body>  
<form> <!-- 如果用的是 Asp.Net 就可能会有这个结点 -->  
  <div class="Wrapper">  
    <div class="Header"></div>  
    <div class="Content"></div>  
    <div class="FooterPush"></div>  
  </div>  
  <div class="Footer"></div>  
</form>  
</body>  
*  
{  
  margin: 0;  
  padding: 0;  
}  
     
html, body, form  
{  
  height: 100%;  
}  
     
.Wrapper  
{  
  min-height: 100%;  
}  
     
  .Wrapper .FooterPush  
  {  
    height: 120px; /* Footer 的高度 */  
  }  
     
.Footer  
{  
  clear: both; /* 清除浮动元素格式 */  
  position: relative;  
  margin-top: -120px; /* Footer 高度的负值 */  
  height: 120px;  
}  

 

posted @ 2020-06-19 11:26  LangZ-  阅读(307)  评论(0编辑  收藏  举报