Right, so instead of using sticky footer, I've decided to create a jQuery function that will change the size of my #mainContent div so that the footer can fit in nicely.
Basically what I'm trying to do is have
#mainContent { height: 100% - 40px; } Where
#footer { height:40px; } I came up with
$(window).resize(function() { var mainContent = $('#mainContent').innerHeight() - 40; $('#mainContent').css("height", mainContent); }); but every time I resize, it simply shortens #mainContent by 40px instead of re-working what #mainContent is supposed to be, then -40px;
$(window).resize(function() { var mainContent = $(document).height() - 80; $('#mainContent').css("height", mainContent); }); I feel like I'm missing something.
Please help.
Edit: header and footer are static (i.e. 40px each), I'd like to resize mainContent without having footer flow over it (because sticky footer uses margin-top:-40px;). I still want my footer to be at the bottom of the screen. Edit2: added the second try.
#footer { position: absolute; bottom: 0; left: 0; width: 100%; height: 40px }