Created
March 21, 2014 09:17
-
-
Save RutledgePaulV/9682500 to your computer and use it in GitHub Desktop.
This little mixin handles everything necessary to get a 'sticky' footer. Simply pass in the selectors for the DOM elements as described below.
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
.force-height(@height: 100%) { | |
height: @height; | |
min-height: @height; | |
} | |
.apply(@selector: ~'', @contents){ | |
@{selector}{ | |
@contents(); | |
} | |
} | |
.sticky-footer(@wrap:~'#wrap', | |
@content-wrap:~'#content-wrap', | |
@footer-push:~'#footer-push', | |
@footer-wrap:~'#footer-wrap', | |
@height: 100px, @buffer: 25px) { | |
@wrap-rules:{ | |
.force-height(); | |
}; | |
@content-wrap-rules:{ | |
min-height: 100%; | |
height: auto !important; | |
margin-bottom: -@height; | |
}; | |
@footer-push-rules:{ | |
.force-height(@height); | |
}; | |
@footer-wrap-rules:{ | |
padding-top: @buffer; | |
margin-top: @buffer; | |
.force-height(@height - @buffer); | |
}; | |
.apply(@wrap,@wrap-rules); | |
.apply(@content-wrap, @content-wrap-rules); | |
.apply(@footer-push, @footer-push-rules); | |
.apply(@footer-wrap, @footer-wrap-rules); | |
} | |
Author
RutledgePaulV
commented
Mar 21, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment