View Full Version : Div full height of screen

10-25-2011, 08:31 PM
Hi all.

This question is probably pretty stupid, I just started working with HTML and CSS and all, so I even had a lot of problems trying to build a simple website. All of them are solved now, but I still have one problem.

I have three main divs: a header, a container div and a content div. But, my construction is a little bit complex. The content div is where I place all my text. I tried to put a background in the CSS of this content div, but that didn't work because my background and text would float over my header (some z-index issue).
The container contains my entire other two divs, and I putted the background (the one that was supposed to be the background of the content div) in the container CSS. This solved the problem of my background floating over my header. My header, well, just contains my header image.

Now everything is fine, except for one thing. The background from my container does not fill my entire page. The background from my container has to be the same length as the content div (where the background should actually be).

I tried to solve this by putting

min-height: 100%;
height: auto
but this only makes the div as long as the browser (my layout and content is longer than my browser).

Is there a way to make the div (and so also the background) as long as my entire page (so not just as long as the browser) OR is there a way to make a certain div (in this case, the container div) the same height as another div (content div).

I know this probably sounds really weird and maybe nobody understands what I mean, but I don't know how to explain it properly.

Thanks in advance.

10-25-2011, 08:33 PM
A link to your live test site would be most helpful in someone trying to debug your issues.

If no live site, then please post all your html and css using the # button to wrap your code in code tags.

10-25-2011, 08:48 PM
if you want the background image to cover the entire page, you could apply it to the body element instead of your container div.

10-25-2011, 09:18 PM
Oh, I forgot to tell! I already have a background image in my body, the background image I'm talking about now is just the background for the text. But now, I wonder, maybe I can solve this if there is a possibility to add a second background to the body?

10-26-2011, 01:06 PM
Seems I have the same problem as explained here: http://csscreator.com/node/32234

Only thing is, it was solved by removing a certain reset file linked from Yahoo, which I don't have.

Any ideas?