Last active
March 15, 2017 08:30
-
-
Save neeraj87/2a717c4a4436e8c25a0b111a1234acf8 to your computer and use it in GitHub Desktop.
Keeping footer of a site to the bottom of the page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<style> | |
html, | |
body { | |
margin:0; | |
padding:0; | |
height:100%; | |
} | |
#container { | |
min-height:100%; | |
position:relative; | |
} | |
#header { | |
background:#ff0; | |
padding:10px; | |
} | |
#body { | |
padding:10px; | |
padding-bottom:60px; /* Height of the footer */ | |
} | |
#footer { | |
position:absolute; | |
bottom:0; | |
width:100%; | |
height:60px; /* Height of the footer */ | |
background:#336633; | |
} | |
</style> | |
<div id="container"> | |
<div id="header"></div> | |
<div id="body"></div> | |
<div id="footer"></div> | |
</div> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Credit goes to this site/author: http://matthewjamestaylor.com/blog/keeping-footers-at-the-bottom-of-the-page
I have just created this gist in case that page is ever lost.