View Full Version : Div stretches to bottom of screen,

10-07-2004, 04:27 PM
hi on my site www.majd-gfx.com , the content div stretches to the bottom of the div and not just the content height, how can i prevent that? i have looked at my css many times but i couldn't figure out what was going wrong, all the opened divs are being closed and the content div does not specify any height so it should only stretch to the content height.

10-09-2004, 02:07 PM
First, let me say that you might find this all easier if you'd just give in and use a table for all the aligning. I just had to say that, is all.

In the mean time, I'm looking at two unclosed div tags that could be the culprits (in fact, upon further consideration, I think they probably are).

You defined background color in three separate divs in which you have your content (the ones with the paragraph in Latin). On the third and last of these, you closed the div tag defining it's background color. On the first two, you did not. I would start by closing those.

If that doesn't pan out (although I think it will), you might want to double check not -if- but -where- you've closed your tags. Sometimes I will accidentally close a tag in the wrong place and everything will go massively awry on the page.

So remember that! If something's gone wrong (especially with alignment or dimensions), you've probably overlooked something obvious, but you've looked at your code so many times your eyes are skimming right over it. I can't tell you how many times I've driven myself to distraction with something like that, only to come back to it later and immediately spot the problem.

10-09-2004, 02:11 PM
Also the div tag defining the background of the line that contains the phrase I am just testin out the layout.... is unclosed.

Okay, that's all I see but you might want to hunt around for any more along those lines.

10-09-2004, 02:21 PM
Ignore Candied, has no idea what he's talking about. And just so you know, there are are about five unclosed DIV's in the main page. The seperate updates, and the DIV's that contain them.


Your page is, in fact, not valid HTML 4.01.

10-09-2004, 07:10 PM
oh i didn't realize, thank you

what was happenin was that on my included show_news.php , the closing of the div was a seperate echo and it wasn't being printed. i fixed it now thank you guys.

10-10-2004, 09:37 AM
First of all, I'm a she.

Second, do you think it's even vaguely possible that you could try being pleasant before harshly judging someone?

If you'll look at Majd-GFX's response, you'll see I was right (and first) as to why he was having a problem. I also identified where the problem was happening.

As did you. So we actually agreed on the most important point.

Do you think it's even remotely possible that I was, gasp, perfectly correct and you simply misunderstood me on another point?

Perhaps it was my where not if statement that confused you? I can see where it might. My intent was not where on the page, but rather where in relation to other tags. For instance... if you closed a table tag before closing the table cell tag, it could very easily result in a layout problem.

Granted, his page is laid out using div tags, but still I thought it worth mentioning, because I've helped my friends with their webpages so many times and seen many errors along those lines (as well as missed closing tags), and I didn't exactly go over his source with a fine-tooth comb. Of course he didn't miss them, the echo wasn't printing them out (which didn't even occur to me, which was admitedly a brain fart) but I still pointed out where the problem was occuring.

I mentioned overlooking small errors because it's true. Most errors that cause major problems are very minor, and just come from not noticing something. So I thought I'd point that out.

Everything I said may not have been worded as perfectly as it might have been (hey, I was sleepy) but none of it was incorrect and certainly not stupid, even if you did misunderstand it.

I don't know if you thought it would be OK to be rude because I'm a newbie to these forums and you're an old hand, or if you just don't like giving people a chance. You're entitled to your opinion, but maybe you should just consider politely giving people a chance to clarify before you judge them to be below you.