Results 1 to 5 of 5

Thread: div background color beyong window height

  1. #1
    Join Date
    Oct 2007
    Posts
    53
    Thanks
    13
    Thanked 1 Time in 1 Post

    Question div background color beyong window height

    Hey all, I have the height for a div set to 100% and the background color set to white. For some reason (in all browsers), the background color is always 100% height, even when the content overflows and the page scrolls. The background color only extends to the height of the window.

    Relevant code:
    HTML Code:
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <meta charset="utf-8" />
    <link rel="stylesheet" href="styles/layout.css" type="text/css" />
    <title>Site</title>
    </head>
    
    <body>
    <div id="container">
      <div id="left">
      </div>
      <div id="right">
        <br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
      </div>
    </div>
    </body>
    </html>
    css:
    Code:
    @charset "utf-8";
    html, body {
    	width: 100%;
    	height: 100%;
    	min-width: 760px;
    	margin: 0px;
    	color: #440B00;
    	font-family: Arial, Helvetica, sans-serif;
    	background: #440B00;
    }
    #container {
    	position: absolute;
    	width: 760px;
    	height: 100%;
    	left: 50%;
    	margin-left: -380px;
    }
    #left {
    	float: left;
    	width: 160px;
    	height: 100%;
    	background: #FFD084;
    }
    #right {
    	float: left;
    	width: 600px;
    	height: 100%;
    	background: #FFFFFF;
    }

  2. #2
    Join Date
    Nov 2006
    Location
    chertsey, a small town 25 miles south west of london, england.
    Posts
    1,920
    Thanks
    2
    Thanked 267 Times in 262 Posts

    Default

    Hi there AmenKa,

    check out the attachment for a solution to your problem.

    Further reading on the method used:-

    coothead

  3. The Following User Says Thank You to coothead For This Useful Post:

    AmenKa (03-07-2011)

  4. #3
    Join Date
    Oct 2007
    Posts
    53
    Thanks
    13
    Thanked 1 Time in 1 Post

    Default

    Thanks for the response, but I already have a similar optimized work around in place. I was hoping for something pure css or a reason why it is standards compliant for all of the browsers (even IE) to render the background color that way.

  5. #4
    Join Date
    Sep 2007
    Location
    The Netherlands
    Posts
    1,881
    Thanks
    49
    Thanked 266 Times in 258 Posts
    Blog Entries
    56

    Default

    I don't know if I understand you well, bur if you want the div with id=right to always cover the whole screen (vertically), then you should not have:
    Code:
    #right {
    	float: left;
    	width: 600px;
    	height: 100%;
    	background: #FFFFFF;
    }
    but
    Code:
    #right {position:relative;top:0px;bottom:0px;
    	float: left;
    	width: 600px;
    	background:#FFFFFF;
    }
    Arie Molendijk.

  6. The Following User Says Thank You to molendijk For This Useful Post:

    AmenKa (03-14-2011)

  7. #5
    Join Date
    Oct 2007
    Posts
    53
    Thanks
    13
    Thanked 1 Time in 1 Post

    Default

    Progress made. Yes, this is a good start. Now I need both the left and right divs to have the background color fill the page vertically.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •