Old 24-04-2008, 10:07   #1 (permalink)
abbasinho
Branding Bitch
 
Join Date: May 2007
Posts: 84
divs stretching divs

i'm having a slight issue with a site i'm building. i've got a div container with a fixed height, and a content div inside that - which will contain all text/images etc.

what i want is the div container to expand downward when i add to the content div.

any ideas??
  Reply With Quote
Old 24-04-2008, 10:11   #2 (permalink)
herkalees
Semantics, yay.
 
herkalees's Avatar
 
Join Date: Nov 2005
Location: Salem, Massachusetts
Posts: 1,088
Instead of setting a fixed height on the container div, set a min-height.

So, change height:XXXpx; to min-height:XXXpx;
__________________
  Reply With Quote
Old 24-04-2008, 10:13   #3 (permalink)
MikeMackay
Everything is fine.
 
MikeMackay's Avatar
 
Join Date: Feb 2005
Location: Witham & London
Posts: 744
Send a message via MSN to MikeMackay Send a message via Skype™ to MikeMackay
Sounds like you're after the "min-height" property as this will stretch downwards if/when the content inside your div expands. Otherwise it will stay at the height you specify.

A word of warning though, this property is not supported in IE 5/6 so you'll need to do the necessaries to "emulate" it in those browsers. There are plenty of links on Google for fixing this.

Hope that helps!

- Mike

Edit: Looks like Marc beat me to it
__________________
  Reply With Quote
Old 24-04-2008, 10:32   #4 (permalink)
pgo
i'm done, son
 
Join Date: Jan 2005
Posts: 12,262
Here's the real question to ask yourself - do you actually need the min-height? Is there a reason the height can't be auto?
  Reply With Quote
Old 24-04-2008, 10:41   #5 (permalink)
abbasinho
Branding Bitch
 
Join Date: May 2007
Posts: 84
so for example,

i have a container div with the height set to auto

inside that a div with an absolute height

will the container div stretch to the height of the div inside with the absolute height??
  Reply With Quote
Old 24-04-2008, 10:57   #6 (permalink)
herkalees
Semantics, yay.
 
herkalees's Avatar
 
Join Date: Nov 2005
Location: Salem, Massachusetts
Posts: 1,088
Yes - it would probably take less time than asking us to just setup a test page with these elements and see for yourself...
__________________
  Reply With Quote
Old 24-04-2008, 11:19   #7 (permalink)
abbasinho
Branding Bitch
 
Join Date: May 2007
Posts: 84
yeah i would but i'm at work at the moment on the day job, don't have dreamweaver on my comp at work.
  Reply With Quote
Old 24-04-2008, 11:23   #8 (permalink)
Zygote76
Senior Member
 
Zygote76's Avatar
 
Join Date: Oct 2007
Location: Ohio
Posts: 160
You could always use notepad
  Reply With Quote
Old 24-04-2008, 11:39   #9 (permalink)
abbasinho
Branding Bitch
 
Join Date: May 2007
Posts: 84
true... cheers for the help.
  Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search


Contact Us - Web Design Forums - Archive - Top
Search Engine Optimization by vBSEO 3.0.0 RC8