Web Hosting Talk







View Full Version : Adjustable height using CSS?


lexington
09-06-2008, 12:44 PM
Hello, I have a friend helping me with a CSS design but it takes him about a week to make one simple change so I would like to fix this one thing myself. I once asked him now to make a div height variable so the more text/data is in the area it automatically moves the other divs around it to the next line. He fixed it but I do not want to bother him again so I would like to know how to do this. Could you please give me a working example of code so that if there are added rows it would push the div content below it to the next line instead of overlapping each other. I can set a manual height: 150px and it works but if there is no text on that section it just displays a big empty space which is why I want a variable height. I tried searching all over google and cannot find that. Thanks :)

larwilliams
09-06-2008, 12:56 PM
Usually height:auto will take care of this. Take a look at a site I put together recently, premiumdjs dot com, and see how it is done there. Hope it helps :)

lexington
09-06-2008, 12:59 PM
Yeah I tried that before creating this topic but it didn't work.

larwilliams
09-06-2008, 01:22 PM
Did you try using position: on your divs?

Jay August
09-06-2008, 01:34 PM
just remove the height, there's no need to add it, unless you want a specific height. Adjustable height is actually the default setting. If it doesn't work, there's other CSS probably interfering. Do you have a live example?

lexington
09-06-2008, 01:39 PM
Thanks for the help guys but I just used php to detect how many characters are on the page and to insert the height div based on the results and that does the trick for now.