2016-10-21 57 views
0

我有一个页脚,我总是希望在底部是这样的:页脚位置

enter image description here

它必须在所有时间的底部。我认为正确的方式做,这是用CSS:

#generated_footer_date { 
color:#ffffff; 
width:100%; 
background-color:rgba(0, 0, 0, 0.6); 
text-align:center; 
padding-top:15px; 
height:50px; 
font-family: 'Raleway', sans-serif; 
position:absolute; 
right: 0; 
bottom: 0; 
left: 0; 
margin-top:100px; 
} 

但现在当我点击生成它显示这使得网页不再是网页和enter image description here

上的数据当我属点击te页面变长,但页脚停留在自己的位置,看起来像这样。我想我可以用jquery解决这个问题。如果我点击按钮,我可以改变页脚的位置从绝对到相对,然后它会工作,但我可以用CSS做到这一点?

+1

使用JavaScript它。按窗口的高度Onclick事件匹配高度并根据它设置位置。 –

+0

你能发布更多的html吗? –

+0

啊哈我不认为在这种情况下需要html @Dejan.S – Kevin

回答

3

试试看:

footer{ 
    position: fixed; 
    bottom: 0 
} 
2

尝试从position: absolute;更改为position: fixed;

#generated_footer_date { 
    color:#ffffff; 
    width:100%; 
    background-color:rgba(0, 0, 0, 0.6); 
    text-align:center; 
    padding-top:15px; 
    height:50px; 
    font-family: 'Raleway', sans-serif; 
    position: fixed; 
    right: 0; 
    bottom: 0; 
    left: 0; 
    margin-top:100px; 
}