View Single Post
Old 06-01-2009, 02:50 PM   #23 (permalink)
hjalmar
The Contributor
 
Join Date: Nov 2008
Location: Sweden
Posts: 36
Thanks: 1
hjalmar is on a distinguished road
Default

Quote:
Originally Posted by allworknoplay View Post
Sure, here's my CSS:

Code:
.body_main {
	background:#FFFFFF;
	margin-top: 200px;
	width: 1024px;
	height: 500px;
	margin: auto;
	padding: 5px 5px 5px 5px;
	border: 1px solid #CCCCCC;
}
Then I create the main DIV container like this:

Code:
<div class="body_main"></div>
So when there is a lot of content, it just flows pass the height that I set at 500px. I don't want the content to be hidden or flow pass the div container, I'd like it to stretch the height as much as it needs to for it's content.

I haven't tried Tanax's tip yet but I will today...
I'm afraid his method wont work, it's not about clearing anything. Now as I said in my previous reply there is a css property that is called min-height:, max-height... etc (look a post up :)) but the support for it is well pretty bad. :/

There could be some ways around it but that depends on your full markup and the design in question. could it be that you are trying to achieve a faux column type effect? because there is a hack where you push your element to be verry long and then making it adjust/wrap to it's content with negative values again.

But it all depends really, can you maybe post the full code and/or atleast a screenshot of the design?

There is some downsides tothat method, and that is that it has to have a wrapper and thata wrapper must be positioned (relative/absolute/never tried fixed as it is also crappy supported in IE) for opera not to flip out, and IE6 and it's annoying stackorder :(.

Code:
#container{
position: relative; /* for opera , also remember that IE makes a new stackorder for positioned elements so for a more complex layout there could cause some issues. */
overflow: hidden;
}

#element_to_span{
margin: 0 0 -30000px;
padding: 0 0 30000px;
}
I've found that going over 32000px causes some issues in firefox with the border, dunno if there would be more issues but yeah 30k is a lot

Last edited by hjalmar : 06-01-2009 at 03:12 PM.
hjalmar is offline  
Reply With Quote
The Following User Says Thank You to hjalmar For This Useful Post:
allworknoplay (06-01-2009)