首页 > 解决方案 > 如何在css3中将填充/边距设置为页脚

问题描述

滚动时我无法查看我的内容,因为粘性页脚隐藏了内容。我想始终将页脚设置为边缘顶部或填充顶部以能够看到内容。如何将页边距顶部或填充顶部设置为粘性页脚?如果我添加stickyfooter,我需要在内容和stickyfooter 之间留一些空间。

http://jsfiddle.net/a6c8rf4y/1/

#footer
{       
bottom:0px;
width:100%;
height:50px;
position:fixed;    
height: 50px;
line-height: 50px;
background-color: #C97;
}

标签: css

解决方案


通过添加

.content {
  margin-bottom: 50px;
}

在您的 CSS 中,您的内容会在底部留出足够的空间,以便在用户一直向下滚动时让您的粘滞页脚适应。


推荐阅读