将页脚固定在页面底部

时间:2016-12-06 00:06:29

标签: html css footer

当我尝试将页脚固定在底部时

var arr = [ 0, 0 ];
var x = [ arr, arr, arr ];

我将页脚固定在底部,但始终保持在屏幕中,如何修复内容的底部并使其可以调整内容大小?

2 个答案:

答案 0 :(得分:0)

position: absolute与窗口有关。您需要在具有position:relative

的容器div中将其更改为timenow

答案 1 :(得分:0)

如果您想同时在窗口中显示内容和页脚,可以使用 overflow-y:scroll ,然后使用**position:fixed;** <修复页面底部的页脚/ p>

&#13;
&#13;
html,body{
  width:100%;height:100%;
  }
div{
  width:100%;
  background-color:red;
  height:80%;
  overflow-y: scroll;
  }
footer{
  width:100%;
  position:fixed;
  bottom:0;
  background-color:yellow;
  height:20%;
  }
&#13;
<div id="content">
afsal khan added user andaman naveen on Nov 21st U added user afsal khan on Nov 7th D deleted User afsal on Nov 7th U added user afsal on Friday U added user afsal on Thursday L afsal khan added a new Template 'Flatkit' on Thursday L afsal khan added a new Template 'Elite Green' on Thursday L afsal khan added a new Template 'Elite Blue' on Thursday U afsal khan added user dsaaa on Tuesday U added user afsal khan on Oct 28th more afsal khan added user andaman naveen on Nov 21st U added user afsal khan on Nov 7th D deleted User afsal on Nov 7th U added user afsal on Friday U added user afsal on Thursday L afsal khan added a new Template 'Flatkit' on Thursday L afsal khan added a new Template 'Elite Green' on Thursday L afsal khan added a new Template 'Elite Blue' on Thursday U afsal khan added user dsaaa on Tuesday U added user afsal khan on Oct 28th more afsal khan added user andaman naveen on Nov 21st U added user afsal khan on Nov 7th D deleted User afsal on Nov 7th U added user afsal on Friday U added user afsal on Thursday L afsal khan added a new Template 'Flatkit' on Thursday L afsal khan added a new Template 'Elite Green' on Thursday L afsal khan added a new Template 'Elite Blue' on Thursday U afsal khan added user dsaaa on Tuesday U added user afsal khan on Oct 28th more 
  afsal khan added user andaman naveen on Nov 21st U added user afsal khan on Nov 7th D deleted User afsal on Nov 7th U added user afsal on Friday U added user afsal on Thursday L afsal khan added a new Template 'Flatkit' on Thursday L afsal khan added a new Template 'Elite Green' on Thursday L afsal khan added a new Template 'Elite Blue' on Thursday U afsal khan added user dsaaa on Tuesday U added user afsal khan on Oct 28th more 

</div>
<footer>footer here</footer>
&#13;
&#13;
&#13;