无论页面是否有内容,如何将页脚放在每个页面的底部?

How to keep my footer on the bottom of every page regardless if the page has content or not?

我正在使用默认的 Web 应用程序 MVC 项目,如果我在页面上没有太多内容,页脚就会上升。如何让页脚始终位于页面底部?

我的html结构是这样的

<body>
  <div class="body-content"><div>
  <footer></footer>
</body>
<!doctype html>
<html>
<head>
<title>Sticky footer</title>
<meta charset="UTF-8"/>
<style>
html, body {
height: 100%;
background: #e4e4e4;
margin: 0px;
padding: 0px;
}
.wrapper {
min-height: 100%;
width: 100%;
}
.main {
clear: both;
overflow: auto;
padding-bottom: 100px;
}
footer {
margin-top: -100px;
background-color: #1b1e25;
height: 100px;
line-height: 100px;
text-align: center;
color: #fff;
}

</style>
</head>
<body>
<div class="wrapper">
<div class="main">
<p>Some content</p>
</div>
</div>

<footer>
<p>footer</p>
</footer>
</body>
</html>

原始出处:http://www.cssstickyfooter.com/