Created
February 26, 2012 20:53
-
-
Save mokagio/1918937 to your computer and use it in GitHub Desktop.
Twitter Bootstrap + Sticky Footer + Fixed Nav Bar
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
html, body, .container, .content { | |
height: 100%; | |
} | |
.container, .content { | |
position: relative; | |
} | |
.proper-content { | |
padding-top: 40px; /* >= navbar height */ | |
} | |
.wrapper { | |
min-height: 100%; | |
height: auto !important; | |
height: 100%; | |
margin: 0 auto -50px; /* same as the footer */ | |
} | |
.push { | |
height: 50px; /* same as the footer */ | |
} | |
.footer-wrapper { | |
position: relative; | |
height: 50px; | |
} |
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> | |
<head> | |
<link rel="stylesheet" href="bootstrap.min.css" /> | |
<link rel="stylesheet" href="sticky.css" /> | |
</head> | |
<body> | |
<div class="navbar navbar-fixed-top"> | |
<div class="navbar-inner"> | |
<div class="container"> | |
<a class="brand" href="#">EngineerGio's Sticky Bootstrap</a> | |
</div> | |
</div> | |
</div> | |
<div class="container"> | |
<div class="content"> | |
<div class="wrapper"> | |
<div class="proper-content"> | |
<div class="row"> | |
<div class="span12"> | |
Content | |
</div> | |
</div> | |
</div><!-- /.proper-content --> | |
<div class="push"></div> | |
</div><!-- /.wrapper --> | |
<div class="footer-wrapper"> | |
<footer>That's the sticky footer</footer> | |
</div> | |
</div> | |
</div> | |
</body> | |
</html> |
.footer-wrapper {
position: relative;
height: 50px;
width: 100%; /* Add this line for full width */
background-color: #000; /* ofc you need the color */
}
😱 hey guys, @davidtzvi and @Jermanis, I've had no idea you ever commented on this gist till now, almost 2 years later! I do apologise for not having replied to you 😞
Thanks to @jerimianhshort for the help.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I second davidtzvi's comment.. "Hey there, any chance you can point me in the right direction for making the footer background-color extend 100% of the viewport?"