How do you make a div expand or collapse to fit the amount of content in it? For example, we have this page which has too much space at the bottom when you first enter, then when you click an option it has too little. (Please excuse any oddities in the wording of the page; we've uploaded the script but haven't fixed all the text.) I read before that you can't change div height like that, but I'm pretty sure I've seen websites do it.

You need to position all your divs relatively to each other, and have the main div (I believe it was called div2) 'height: auto;', that should work...

Very true. Posted too quickly after reading his first line...

Thanks! I needed to do a lot to clean up the style sheet, but I think what really fixed it was:

- float div2 left (it contains two divs, one floated left and the other floated right)
- set "min-height: 100%" for div2
- set "clear: both" for div3

We haven't yet fixed the page I mentioned in the original post, but the home page of the site and some others.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.