Search code examples
htmlcssheaderfooter

CSS content area of our site is scrolling when it should not


Ok, so the issue is I have a header, footer and the content div and what I want is for the content div to auto fill the height of the browser between header and footer making the footer stay on the bottom of the page, or below the content length.

when you go to incard.com.au you can see the issue on the index page as the content area is smaller then the browser window so we have added a height to the div to solve the footer floating issue.

I fixed it using jquery

$('#sitewidth').css({'height':(($(document).height())-320)+'px'});
        $('#contentbody').css({'height':(($(document).height())-320)+'px'});

Solution

  • I was able to fix the solution by using Javascript, it seems that to get the height of the content to fit the whole screen correctly I had to do a math thing where I took the height of the footer and header away from the browser screen size and then that gave me the min-size of my content body. as it is different on each users screen size it had to be a javascript set function.