I’ve seen this question asked a hundred times and I’ve tried all the solutions given and I still haven’t managed to get this to work.
The problem: I have a parent DIV with four child DIVs two with content, two only for looks:
([site shadow] [left menu] [content area] [right shadow])
When the content area has enough text to expand the content area I want the right shadow and left menu graphics to expand down the page with the rest of the DIVs.
I have tried adding a clear:both to the parent div and that does nothing. I’ll include the relevant code below.
I should add that the shadow on the right of the web page disappears completely when adding a height % to the parent DIV
Additionally if I add a very large height:4000px to the parent div everything cooperates like I want, although I want the site to re-size to content not just to 4000px.
The relevant HTML:
<div id="body_area">
<div id="body_left"></div><!-- just a left page graphic -->
<div id="sidebar">
some info here
</div>
<div id="content_area">
enough text here to cause the div to expand beyond browser height.
</div>
<div id="body_right"></div> <!-- just a right shadow graphic -->
<div id="footer"></div>
</div>
And the relevant CSS
#body_area{
overflow:auto;
width:1024px;
margin:0px auto;
clear:both;
}
#body_left{
height:516px;
width:25px;
margin:0px;
background:url("images/body_left.jpg") repeat-y;
float:left;
}
#body_right{
height:100%;
width:28px;
margin:0px;
background:url("images/body_right.jpg") repeat-y;
float:left;
}
#sidebar{
height:100%;
width:213px;
margin:0px;
background:url("images/side_menu.jpg") repeat-y;
float:left;
}
#content_area{
height:100%;
width:758px;
margin:0px;
background:url("images/content_area.jpg") repeat-y;
float:left;
}
#footer{
height:34px;
width:1024px;
margin:0px auto;
background:url("images/footer.jpg");
float:left;
}
If you need a pure
csssolution then it’ll be very difficult to achieve. But to get this done easily you can usejQuery.edit: adding jquery library from a jquery cdn [this will word only when you have active internet connection-in case you didn’t know it]
this works well. But there is a little problem, you have to readjust the width of the
divs inside thebody_areadiv.Thanks
EDIT: Full code