Forum Moderators: not2easy

Message Too Old, No Replies

Get div height to expand as the content grows

Right now my content is going outside of the div into another one

         

SEOViking

7:50 pm on Feb 25, 2005 (gmt 0)

10+ Year Member



I have used the div templates made by some moderator here (great job btw!) and i'm experiencing with one of them. i have split my page into 2 rows. the top row is my content and the bottom is a thin footer. my page content is now overlapping into the footer. how do i get the top one to "grow" longer as the content increases?
Here is my code:
<html>
<head>
<style type="text/css" media="screen">
html, body {
margin: 0;
padding: 0;
background: #666666;
color: #fff;
height: 99%;
text-align: center;
}

#container {
position: relative;
width: 760px;
margin: 7px auto;
text-align: left;
background: #ffffff;
min-height: 99%; /* this is where inheritance stops */
}

/* if you remove this then the container disappears in IE */
html #container {
width: 760px;
height: 99%;
}

#footer
{
position: absolute;
bottom: 0;
margin: 0 0 0 0;
padding: 0 0 10px 0;
height: auto;
width: 760px;
background: #4c4c4c;
}

#top-row
{
position: absolute;
margin: 0 0 0 0;
padding: 0 90px 60px 90px;
width: 580px;
color: #4c4c4c;
}

</style>
</head>

<body>
<div id="container">
<div id="top-row">
<p>(just copy and paste this text a bunch of times if you want to test out the overflowing/overlapping into the footer)<br /><br /><br /></p>
</div>
<div id="footer">
<p>About us ¦ Links ¦ Sitemap </p>
</div>
</div>
</body>
</html>

SuzyUK

3:21 pm on Feb 28, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



..Hi SEOViking,

#top-row {
position: absolute;
margin: 0 0 0 0;
padding: 0 90px 60px 90px;
width: 580px;
color: #4c4c4c;
}

remove the absolute positioning from that rule, it is being taken out of the flow, which is why it's overflowing the bottom of the container.. (which the footer is taking it's position from)


/* if you remove this then the container disappears in IE */
* html #container {
height: 99%;
}

the * is required in that rule it's a hack to target IE Only. IE will stretch the container beyond 99% height if required, but other browsers need the min-height rule in the previous rule.

Suzy

SEOViking

8:56 pm on Feb 28, 2005 (gmt 0)

10+ Year Member



You're a gem! I changed the absolute to the relative (or just deleted the whole line) and added the '*' where you said and it was fixed =)