【发布时间】:2015-12-31 03:25:04
【问题描述】:
这是一个测试代码,但我需要在页面的真正底部设置页脚
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="wrapper">
<?php
for($i=0;$i<100;$i++){
echo $i."<br>";
}
?>
</div>
<footer>
Footer<br>
</footer>
</body>
<html>
和css文件
html, body {
height: 100%;
background-color: grey;
}
.wrapper {
min-height: 100%;
margin-bottom: -20%;
padding-bottom: -20%;
background-color: green;
}
footer {
background-color: blue;
min-height: 20%;
position: absolute;
bottom: 0;
width: 100%;
}
这样将页脚设置在页面底部,但是如果您继续滚动页面,我需要将页脚设置在真正的末尾,当您无法再滚动时,必须放置页脚。
【问题讨论】: