Results 1 to 2 of 2
-
August 10th, 2006, 01:43 PM #1
using overflow with dynamic height
as you can see here, there are two div's, #main (green) and #bottom (red). I need red always to remain at the bottom of the user's screen, I don't want them to scroll past it. Ok that works. But the height of green will be based upon the content inside of it, which is different for each page. So if the user shrinks his browser far enough, much of the text in green becomes hidden. I figure overflow:auto would do the trick by adding vertical scrollbars if red overlaps green, but green's height is dynamic. Is there a way to overcome this?
-
August 10th, 2006, 03:32 PM #246Registered User
postsYou'd most likely have to use some javascript to get it sized correctly. Especially for IE. Here's the CSS I would use:
Then I'd write the divs like this:Code:body { background:#F90; padding:0; margin:0; text-align:center; } #container { height: 618px; width: 412px; overflow: auto; margin:0 auto; } #main { background:#00FF00; width: 400px; text-align:left; margin:0 auto; } #bottom { position:absolute; bottom:0px; left:50%; margin:0 -205px; width:400px; height:250px; background:#FF0000 }
The javascript would set the height: of #container on the load of the page, and page resize.Code:<div id='container'> <div id="main"> </div> </div> <div id="bottom"></div>

Reply With Quote

Bookmarks