Many web developer always think about why footer is not sticking to end of browser.
This is senorio:
If content is less then footer need to go bottom of browser and if content is more then footer will go down as per content.
Many people think this is CSS developer’s But I am not think that way. Becasue this is totally different problem.
Some people suggest to use header, middle container and footer height in percentage. But that is wont be possible for all the time.
Here I will give you the solution. Use following javascript in document.
<script type="text/javascript">
var header_height = 150;
var footer_height = 100;
var reduce_height = header_height+footer_height;
browserHeight = 0;
if( typeof( window.innerHeight ) == 'number' ) {
//Non-IE
browserHeight = window.innerHeight;
} else if( document.documentElement && ( document.documentElement.clientHeight ) ) {
//IE 6+ in 'standards compliant mode'
browserHeight = document.documentElement.clientHeight;
} else if( document.body && ( document.body.clientHeight ) ) {
//IE 4 compatible
browserHeight = document.body.clientHeight;
}
// window.alert( 'Height = ' + browserHeight );
var min_height = browserHeight-reduce_height+ +"px"
document.write('<style>#middle_container{min-height:'+ min_height +'}</style>');
//document.getElementById("middle_container").style.minHeight = browserHeight-146+"px";
</script>
Here in this javscript I am assuming middle_container is your main block of content. You can change the variables as per your need.







Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?
I was just having a conversation over this I am glad I came across this it cleared some of the questions I had.
This post makes a lot of sense !