2016-01-13 87 views
1

CSS的底部:CSS棒页脚背景页面

.footer { 
background-image: url("./images/footer.png"); 
height: 45px; 
background-position: center center; 
background-repeat: no-repeat; 
position: relative; 
bottom: 0; 
} 

HTML

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <title>My title</title> 
</head> 
<body> 
    .. some header divs.. 
    .. some content divs.. 
<div class="footer">FOOTER</div> 
</body> 
</html> 

页脚是bootom前约10个像素。我如何将它添加到页面的最底部?

+1

补充身体保证金:0 –

+1

我不知道你会找到你上面的例子...如果用户有什么5K显示器的完整解决方案和内容仅填满屏幕的一半。您应该查看将脚注背景添加到主体类,然后独立设置内容元素背景颜色以涵盖所有可能的场景。 – Aaron

+1

[浏览器的默认CSS样式表]可能的重复(http://stackoverflow.com/questions/32875/browsers-default-css-stylesheets) –

回答

1

添加此CSS

body { 
    margin:0; 
}