我想创建一个与内容相关的页脚(因此不固定),但会填充屏幕的其余部分。因此,例如,在我较大的显示器上,页脚将从同一个位置开始,但填充 100 像素(例如)。在较小的显示器上,它只需要填满 75px。我尝试使用 100%,但它会导致页面非常大,用户可以向下滚动并用页脚填充整个屏幕。有没有办法让它变得更合理一些,让它刚好填满屏幕的底部?我目前的代码是这样的:
.footer
{
position:relative; //can't be fixed as content might overlap if extended
height:100%;
width:100%; //fill the entire screen horizontally
bottom:0px;
margin-top:345px; //used to make sure content doesn't overlap
}