Click to See Complete Forum and Search --> : specifying div height:


avatarbilbo
02-13-2007, 05:45 PM
Hi everyone,

I'm working on a new site and came across something I can't figure out. I have all my content text in a div and it works just the way I want it when there is more/less text; it's flexible and will follow the text as far as necessary. However, when there is only a little bit of text, I don't want the div to be really short.

Is there a way to specify an "at least X px" height? So that if there is no content, there will at least be a certain amount of space left, but then when the content overflows it shows it?

It's probably a really easy solution, but my brain is on overload right now...

Here's a link to the temp site:

http://www.davidjcubberly.com/ha/index.html

the style sheet is located here:

http://www.davidjcubberly.com/ha/img/style.css


Thanks so much! I love this forum, it's just SOO helpful.

Dave

Centauri
02-13-2007, 06:04 PM
Specify a min-height on the container - unfortuneately IE doesn't recognise that, BUT it treats height as min-height, so a IE hack works here. Css :#textbox {
background: #E7E8CC;
width: 712px;
border: 3px solid #fff;
margin: 15px;
padding: 7px;
overflow: visible;
font-family: arial, helvetica, sans-serif;
font-size: 8pt;
color: #000;
text-align: left;
min-height: 200px;
}
* html #textbox {
height: 200px;
}


You also don't have a <body> tag in your html, and the <center> tag is deprecated, so replace the <center> tag with <body> and make the following change to your css to center the layout properly #box {
background-image: url('bg.jpg');
background-repeat: repeat;
width: 762px;
border: 3px solid #fff;
margin: 0 auto;
padding: 0px;
overflow: visible;
}

Cheers
Graeme

PS: By the way, the menu rollovers can be done without all that javascript ...

avatarbilbo
02-13-2007, 06:16 PM
Hey, thanks so much! That did it just perfectly!

As for all the javascript... I sort of figure out things little by little... my next project is getting all that to be done with css proper. I only used that because that's what I know works, and wanted to get started on the site. I have the basic idea of how to do that in css, but I'm sure you'll see a thread asking about that soon...

Thanks again, that totally worked great!

Dave