代码:

<!DOCTYPE html>
<html>
<head>
<title>Slide-Up Dialogue Box</title>
<style type="text/css">
body {
margin: 0;
padding: 0;
height: 100%;
}
#container {
min-height: 100%;
position: relative;
}
#header {
background: #ff0;
padding: 10px;
}
#body {
padding: 10px;
padding-bottom: 60px;
}
#footer {
position: absolute;
bottom: 0;
width: 100%;
height: 30px;
background: #6cf;
}
</style>
</head>
<body>
<div id="container">
<div id="header"></div>
<div id="body"></div>
<div id="footer">
Who is Online?
</div>
</div>
</body>
</html>


如何将页脚放在页面底部?我已经尝试过对padding,bottom和margin进行试验,但是到目前为止我还没有取得很大的成功。有人可以告诉我如何将页脚放在页面底部吗?谢谢

最佳答案

您可以做到这一点,先生:

body {
margin: 0;
padding: 0;
height: 100%;
}
#container {
min-height: 100%;
position: relative;
}
#header {
background: #ff0;
padding: 10px;
}
#body {
padding: 10px;
padding-bottom: 60px;
}
#footer {
position: fixed;;
bottom: 0;
width: 100%;
height: 30px;
background: #6cf;
text-align:center;
}


HERE MY CODE

关于html - 如何将页脚设置在页面底部?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32795994/

10-13 02:45