4 replies [Last post]
theaverageidiot
Offline
newbie
Last seen: 11 years 13 weeks ago
Timezone: GMT-4
Joined: 2009-07-02
Posts: 6
Points: 3

How do you make a DIV to always be 100% of the page, regardless of window size? I have a DIV that is set to 100% (it hides behind some other DIV's to fill out the background) and it looks fine with the window all the way open but at smaller resolutions the DIV only stays to the height of the window and doesn't fill up 100% of the document.

I would really, really, really like to not post my code since I think it will confuse you more but if anyone absolutely has to see it then I'll post it.

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 1 week 1 day ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Simply do nothing! A DIV,

Simply do nothing! A DIV, as with all block elements, occupies all available horizontal space by default.

If your DIV doesn't do this, then you have done something in your code to prevent it.

Using a DIV in the way you are doing, however, suggests that you are following really bad code practices. Head on over to a site like HTML Dog and learn proper practices. The time it takes to do this will be recovered many times over as you start designing correctly.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

theaverageidiot
Offline
newbie
Last seen: 11 years 13 weeks ago
Timezone: GMT-4
Joined: 2009-07-02
Posts: 6
Points: 3

More Problems

Well I got my one div ("repeating-line-fix") to fill the whole page, but it still doesn't appear to be working correctly.

http://cargomaxxvan.com/dev/beta/index.html

Resize your browser window smaller and smaller. Once you get to about half size you'll see that there is a color gradient problem in the background. Any idea what the problem is?

And thank you for the suggestion, I'm reading some of the tutorials about page layouts now. I do understand that I have a sloppy knowledge of CSS.[img][/img]

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 1 week 1 day ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

Well, first fix up the html

Well, first fix up the html errors. The CENTER tag is deprecated in the DTD you are using and should never be used anyway.

As I suspected you have a bad case of "divitis" using DIV tags right left and center when more appropriate elements are available.

The DIV tag is not the alternative to the table tag! If you have more than one or two on a page you are abusing it.

As I suggested earlier, head on over to HTML Dog and learn the right approach. It will save you endless trouble.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.

Ed Seedhouse
Ed Seedhouse's picture
Offline
Guru
Victoria British Columbia
Last seen: 1 week 1 day ago
Victoria British Columbia
Timezone: GMT-8
Joined: 2005-12-14
Posts: 3570
Points: 675

theaverageidiot wrote:I'm

theaverageidiot wrote:

I'm reading some of the tutorials about page layouts now. I do understand that I have a sloppy knowledge of CSS.[img][/img]

You have a sloppy and incorrect knowlege of html too, and that's more important and where you should start. CSS only works well with proper html. With correct html CSS is easy.

Ed Seedhouse

Posting Guidelines

Watch out! I am carrying irony, sarcasm and satire, and know how to use them.