tags:

views:

343

answers:

6

Hi folks, I've been searching through forums to find a solution for the problem I'm facing and couldn't find any. So here I am, again, asking for remedy.

I have this page which encase personal profile form. That form is enclosed in page container div and is quite long that it requires main scrollbar in order to see those hidden. And there's a footer section at the bottom of the page where copyright statements are displayed.

My problem is I can't find a way to make my page container div to stretch along with the body element. I've applied height: inherit to that div but still it refused to stretch so that it covers till the border of the footer section. Now, there is big gap between the footer and that div filled with body background color. Here's a screencap for better understanding.

screencap

/*Form container*/  
#form_container{   
 width: 600px;  
 background-color:#FDAE80;  
 margin-top: 15px;  
 margin-left: 110px;  
 padding-top: 10px;  
 padding-left: 20px;  
 padding-right: 20px;  
 padding-bottom: 10px;  
}  

body{   
 margin-top: 0px;  
 margin-bottom: 0px;  
 height: 100%;   
 background-color: #683468;    
}  

/*Page Container*/  
div.mcontainer{   
 width: 1032px;  
 height: inherit;  
 background-color: #ffffff;  
}  

/*Footer Section*/  
div.footer{  
 width: 1032px;  
 height: 80px;  
 border-top: 1px solid #683468;  
 margin-top: 10px;  
 text-align: center;  
 font-family: Arial;  
 font-size: 12px;  
 color: red;  
 position: relative;  
 bottom: 0px;  
 background-color:black;  
}  

Any help would be appreciated.

EDIT Just to clarify, Footer section is inside page container div. Here my html - htm

A: 

Try to use overflow: hidden; on div.mcontainer.

thomasvdb
That will cropped my form and I've tried that already. What I want to do is, to have the mcontainer stretch along with my form and body so that it touches the top border of my footer. You can see the problem in my pic. I just don't want the unsightly gap that filled with body's background colour.
Andrew
well, actually, I forgot that footer is also inside the page container div. So it would be wrong to say it isn't stretch cuz the footer is at the bottom of the page which is where is supposed to be. The problem is page container div background colour ceased exactly at the end of browsing area height and that's where background colour of body element starts. So, in other words, my page looks perfect until I scroll it down.
Andrew
A: 

try adding html to the height to:

html, body {
    height: 100%;
}

as discussed on A List Apart: http://www.alistapart.com/articles/footers/

Patrick
Nope it doesn't work. Just to clarify, the footer section is enclosed inside page container div(mcontainer).
Andrew
sorry double post
Andrew
+1  A: 

Try adding a clearing element as the last item in your page container, after all the form elements. Could be <br clear="all" /> or a div with style clear:both.

A better idea - remove the height: inherit; from your mcontainer style. This fixed it for me.

Ray
It doesn't work. Just to clarify, the footer section is enclosed inside page container div(mcontainer).
Andrew
oh - then you may need another intermediate container to hold the form element and display the background color. Add the clearing element to this new div. If this doesn;t help, you may want to post your html layout elements (you could probably leave out most or all of the actual form elements).
Ray
It does have intermediate container that holds form elements and has different background colour which you can see it in posted link. It seems to me that the problem lies in div.mcontainer in a sense that it stops filling background colour(white) at the end of browsing area height and that's where background colour of body elements kicks in. Because the footer element is located where it supposed to be which is at the bottom of the page. As for posting html code, it's too long to post here so, instead I posted in pastebin, and put the link in my original post.
Andrew
@user - see my edit for an idea that actually seems to work.
Ray
@RAY You are super genius. IT WORKS!! Thanks so much.
Andrew
@RAY: if you don't mind, can you explain to me why is it necessary to add div clear:both at the end of that container?
Andrew
<bow> <applause> <blush> A floated container does not expand to contain its contents. (I don't know why that is true, but it is.) Adding a clearing element at the end forces the container to expand to fit.
Ray
Thanks again for explanation. :)
Andrew
A: 

If you have floating elements in your container, try placing clear-both-div at the end of the container div:

<div id="mcontainer">
    ...code

    <div style="clear:both;"></div>

</div>
Pbirkoff
Nope it doesn't work. Just to clarify, the footer section is enclosed inside page container div(mcontainer).
Andrew
A: 

I had the same problem, now I am using java script (jQuery) to solve it.

In my case it was the div for the menu bar and I calculated the height from the main container plus the height from the header.

$(document).ready(function(){
    var h = $(".main").height() + $(".main").position().top
    $(".lmenu").css({height:h+"px"})
    $(".rmenu").css({height:h+"px"})
});

Right now it seems to make more sense to use the height of the body:

$("body").height()

If there is a version without javascript, it would be interesting to know. But meanwhile this could be a workaround.

HWM-Rocker
Ya I'm also starting to think jquery would be the solution.
Andrew
A: 

Maybe you should try adding: clear: both to footer class

Sinan