0

I've been trying all methods to stretch the background color to fill 100% of the page but it doesn't work in Firefox 3. It just stretches to where the content is. It seems to work fine in IE 7, but there is some space to scroll up and down.

Here's my CSS:

body {
	height: 100%;
	background-color: #666;
	margin: 0px;
	margin-top: -1px;
	background-image: url(Background.jpg);
}

.container {
	height: 100% !important;
	min-height: 100%;
	background-color: #252525;
	width: 80%;
	min-width: 1000px;
	max-width: 1400px;
	border: #444 1px solid;
	margin: 0px;
}

And this is my HTML:

<body>

<center>
<div class="container"> <!-- Open -->
<div class="header"></div> <!-- Header -->

<!--       Content      -->
<div class="page">
<div class="content">Content</div><div class="sidebar"> Sidebar </div>
</div>

<!--    Footer     -->
<div class="footer">
<br /><br /><br /><br /><br /><p><span class="footercont">
Footer
</span></p></div>

<div class="fill"></div> <!-- Fill -->

</div> <!-- Close -->
</center>

</body>

Many thanks to those who help me.

5
Contributors
7
Replies
9
Views
9 Years
Discussion Span
Last Post by Rhyan
0

yea never gotten 100% height working in all browsers w/o js. change your .container to #container

function divSize() {
	winH = document.body.offsetHeight;
	totalHeight = document.getElementById('container').offsetHeight;
if(winH > totalHeight) {
 document.getElementById('container').style.height=winH + "px";
}

window.onresize = function() {
	divSize();
}

If the div is less than the window height it changes the div height to match the window, if its greater then the 100% will work fine. Also when the window is resized it changes the height to make sure its up to date.

0

add this to the head of the pages

window.onload = function() {
divSize();
}


or <body onload="divSize();">
0

It can't be done.

The web is NOT designed to fill a screen. You provide content, and it expands downward to fill whatever area is needed, running off the screen downward if necessary.

Remember that different computers have different resolutions. Combine that with different browsers, and it is quite impossible to make a web page that fits into a screen.

IE has nonstandard extensions to do this, but nobody else implements them.

0

have you tried: html

                         {
                          background-color: .............
                          }

Edited by mike_2000_17: Fixed formatting

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.