I'm hoping someone can give me a bit of advice. I've been making websites as a hobby for about 10 years now, I taught myself what to do with a book from the library. Of course things have moved on in 10 years, and recently I've been trying to get to grips with css to design my sites.

Although I can understand the basics, there are some things I just can't seem to figure out. Mainly this is getting my page (or in css my main content layer) to stretch to the bottom of the page, however long the page is. It always seems to work in one browser, and not in another, and I browse the net for tips and find things that work here, but not there, and so on. It seems to be quite a headache for something that should not be such a weird thing to want to do!

What I am wondering is a/. is there some easy way to sort it out, or b/. is there any good website/book which would teach me how to sort it out if there is no straightforward solution.

I'm quite exacting in how I want my sites to look and it gets depressing when I think I've got it right but then view it somewhere else and it looks a bit 'scruffy'!

9 Years
Discussion Span
Last Post by MattEvans

Okay... can you be a little more specific about the "stretch the full height".

By definition, an element (such as a div etc.) will either automatically expand to contain the content... or remain a set size if you apply a Height to it (barring IE, which treats height as min-height!).

You may be thinking of things lie having "columns" that appear to reach to the bottom of the page etc.?

INote the use of the word "appear".
It's very important... alot of the CSS styling for things like columns is a bit of "smoke and mirros"... things are not as they seem.
So I can only recommend that you go look up things like Faux Columns and Skidoo layouts.

See if those are the sort of thign you are after.


Have you tried setting height:100% to the body and html element? CSS:


This should allow you to make content stretch when it's "too short" to fill the page ( anything height:100% in the page should fill up the height of the page, which shouldn't ever be smaller than the height of the window ). It wont work the other way though ( it wont shrink large content to fill a small page ). Also wont work everywhere, particularly in ancient browsers that dont have any grip of CSS, but these browsers tend to have this behaviour automatically..

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.