JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<title>A CSS Sticky Footer</title>
<!--
The second stylesheet is to make things look pretty.
The first one is only the important one.
-->
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" media="screen" href="layout.css" />
<link rel="stylesheet" type="text/css" media="screen" href="style.css" />
</head>
<body>
<div class="wrapper">
<div class="content">
<div class="header">
<h1>CSS Sticky Footer</h1>
</div>
hello world
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again
<br/>Hello again<br/>Hello again<br/>Hello again
</div>
<div class="push"></div>
</div>
<div class="footer">
<p>Copyright © 2012 Ryan Fait — <a href="http://ryanfait.com/" title="Las Vegas Web Design">Las Vegas Web Design</a></p>
</div>
</body>
</html>
CSS
* {
margin: 0;
}
html, body {
height: 100%;
}
.wrapper {
min-height: 100%;
height: auto !important;
height: 100%;
margin: 0 auto -142px; /* the bottom margin is the negative value of the footer's height */
}
.footer, .push {
height: 142px; /* .push must be the same height as .footer */
}
.footer {
background: #ccc;
}
.content {
/* for testing */ height: 100px;
border-bottom: 1px dashed red;
}
/*
Sticky Footer by Ryan Fait
http://ryanfait.com/