100% Doesn't Work

Reply

Join Date: Aug 2008
Posts: 21
Reputation: Agent Cosmic is an unknown quantity at this point 
Solved Threads: 0
Agent Cosmic Agent Cosmic is offline Offline
Newbie Poster

100% Doesn't Work

 
0
  #1
Nov 11th, 2008
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:
  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:
  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.
CLICK---> GeekPolice
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 247
Reputation: cmills83 is an unknown quantity at this point 
Solved Threads: 1
cmills83 cmills83 is offline Offline
Posting Whiz in Training

Re: 100% Doesn't Work

 
0
  #2
Nov 11th, 2008
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 247
Reputation: cmills83 is an unknown quantity at this point 
Solved Threads: 1
cmills83 cmills83 is offline Offline
Posting Whiz in Training

Re: 100% Doesn't Work

 
0
  #3
Nov 11th, 2008
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();">
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 21
Reputation: Agent Cosmic is an unknown quantity at this point 
Solved Threads: 0
Agent Cosmic Agent Cosmic is offline Offline
Newbie Poster

Re: 100% Doesn't Work

 
0
  #4
Nov 12th, 2008
Do I need to do anything to the html, cause it ain't working.
CLICK---> GeekPolice
Reply With Quote Quick reply to this message  
Join Date: Jan 2007
Posts: 3,210
Reputation: MidiMagic has a spectacular aura about MidiMagic has a spectacular aura about 
Solved Threads: 164
MidiMagic's Avatar
MidiMagic MidiMagic is offline Offline
Nearly a Senior Poster

Re: 100% Doesn't Work

 
0
  #5
Nov 14th, 2008
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.
Daylight-saving time uses more gasoline
Reply With Quote Quick reply to this message  
Join Date: Oct 2008
Posts: 76
Reputation: ccube921 is an unknown quantity at this point 
Solved Threads: 6
ccube921 ccube921 is offline Offline
Junior Poster in Training

Re: 100% Doesn't Work

 
0
  #6
Nov 16th, 2008
have you tried: html
{
background-color: .............
}
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 21
Reputation: Agent Cosmic is an unknown quantity at this point 
Solved Threads: 0
Agent Cosmic Agent Cosmic is offline Offline
Newbie Poster

Re: 100% Doesn't Work

 
0
  #7
Nov 17th, 2008
Yes I did.
CLICK---> GeekPolice
Reply With Quote Quick reply to this message  
Join Date: Oct 2006
Posts: 232
Reputation: Rhyan is an unknown quantity at this point 
Solved Threads: 24
Rhyan's Avatar
Rhyan Rhyan is offline Offline
Posting Whiz in Training

Re: 100% Doesn't Work

 
0
  #8
Nov 18th, 2008
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.
" Of all the things I've lost,
I miss my mind the most...."
Mark Twain
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the HTML and CSS Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC