Last active
April 19, 2016 18:10
-
-
Save simaodeveloper/d754d739b7455301c8238305b1307b14 to your computer and use it in GitHub Desktop.
Sticky Footer
This file contains hidden or 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
O Sticky Footer é uma forma de manter seu rodápé sempre colado no bottom da janela de seu documento (body), com isso não vamos ter problemas de sobra de espaço caso não haja muito conteudo, segue o codigo com a explicação: | |
HTML | |
<html> | |
<head> | |
<link rel="stylesheet" href="layout.css" ... /> | |
</head> | |
<body> | |
<div class="wrapper"> | |
<p>Your website content here.</p> | |
<div class="push"></div> | |
</div> | |
<div class="footer"> | |
<p>Copyright (c) 2008</p> | |
</div> | |
</body> | |
</html> | |
CSS | |
* { | |
margin: 0; | |
} | |
html, body { | |
height: 100%; | |
} | |
.wrapper { | |
min-height: 100%; | |
height: auto !important; | |
height: 100%; | |
margin: 0 auto -155px; /* the bottom margin is the negative value of the footer's height */ | |
} | |
.footer, .push { | |
height: 155px; /* .push must be the same height as .footer */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment