943,670 Members | Top Members by Rank

Ad:
Nov 11th, 2008
0

100% Doesn't Work

Expand Post »
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:
css Syntax (Toggle Plain Text)
  1. body {
  2. height: 100%;
  3. background-color: #666;
  4. margin: 0px;
  5. margin-top: -1px;
  6. background-image: url(Background.jpg);
  7. }
  8.  
  9. .container {
  10. height: 100% !important;
  11. min-height: 100%;
  12. background-color: #252525;
  13. width: 80%;
  14. min-width: 1000px;
  15. max-width: 1400px;
  16. border: #444 1px solid;
  17. margin: 0px;
  18. }

And this is my HTML:
html Syntax (Toggle Plain Text)
  1. <body>
  2.  
  3. <center>
  4. <div class="container"> <!-- Open -->
  5. <div class="header"></div> <!-- Header -->
  6.  
  7. <!-- Content -->
  8. <div class="page">
  9. <div class="content">Content</div><div class="sidebar"> Sidebar </div>
  10. </div>
  11.  
  12. <!-- Footer -->
  13. <div class="footer">
  14. <br /><br /><br /><br /><br /><p><span class="footercont">
  15. Footer
  16. </span></p></div>
  17.  
  18. <div class="fill"></div> <!-- Fill -->
  19.  
  20. </div> <!-- Close -->
  21. </center>
  22.  
  23. </body>

Many thanks to those who help me.
Similar Threads
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Agent Cosmic is offline Offline
51 posts
since Aug 2008
Nov 11th, 2008
0

Re: 100% Doesn't Work

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

HTML and CSS Syntax (Toggle Plain Text)
  1. function divSize() {
  2. winH = document.body.offsetHeight;
  3. totalHeight = document.getElementById('container').offsetHeight;
  4. if(winH > totalHeight) {
  5. document.getElementById('container').style.height=winH + "px";
  6. }
  7.  
  8. window.onresize = function() {
  9. divSize();
  10. }

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.
Reputation Points: 37
Solved Threads: 1
Posting Whiz in Training
cmills83 is offline Offline
249 posts
since Jun 2004
Nov 11th, 2008
0

Re: 100% Doesn't Work

add this to the head of the pages
HTML and CSS Syntax (Toggle Plain Text)
  1. window.onload = function() {
  2. divSize();
  3. }
  4.  
  5.  
  6. or <body onload="divSize();">
Reputation Points: 37
Solved Threads: 1
Posting Whiz in Training
cmills83 is offline Offline
249 posts
since Jun 2004
Nov 12th, 2008
0

Re: 100% Doesn't Work

Do I need to do anything to the html, cause it ain't working.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Agent Cosmic is offline Offline
51 posts
since Aug 2008
Nov 14th, 2008
0

Re: 100% Doesn't Work

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.
Reputation Points: 730
Solved Threads: 181
Nearly a Senior Poster
MidiMagic is offline Offline
3,314 posts
since Jan 2007
Nov 16th, 2008
0

Re: 100% Doesn't Work

have you tried: html
{
background-color: .............
}
Reputation Points: 13
Solved Threads: 6
Junior Poster in Training
ccube921 is offline Offline
93 posts
since Oct 2008
Nov 17th, 2008
0

Re: 100% Doesn't Work

Yes I did.
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
Agent Cosmic is offline Offline
51 posts
since Aug 2008
Nov 18th, 2008
0

Re: 100% Doesn't Work

You may want to check this blog posting.

http://ryanfait.com/sticky-footer/
I think you can modify it in order to achieve your goals. Hope it solves your issue.
Reputation Points: 21
Solved Threads: 26
Posting Whiz in Training
Rhyan is offline Offline
240 posts
since Oct 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in HTML and CSS Forum Timeline: Input Button Background with i18n problem
Next Thread in HTML and CSS Forum Timeline: How do I upload my flash website to the internet?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC