SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    Non-Member
    Join Date
    Sep 2007
    Posts
    43
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Why Doesn't This Work

    Hello,

    The code below displays a div, that remains centered upon the browser window being resized. Why doesn't the div stretch the height of the window, upon entering the statement "HEIGHT: 100%;"?

    Code:
    Body
    {
      MARGIN: 16px 0;
    }
    
    #Container
    {
      WIDTH: 751px;
      HEIGHT: 100%;
      MARGIN: 0 auto;
      BORDER: 1px solid RGB(0,0,0);
    }

  2. #2
    SitePoint Wizard drhowarddrfine's Avatar
    Join Date
    Aug 2005
    Posts
    3,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    #container is 100% of what? If you want it to be 100% of the body, its parent element, then you must give the dimensions of the body. But if you want the body to be 100% high then, same question. 100% of what? The body's parent is html, so html{height:100%}

  3. #3
    The CSS Clinic is open silver trophybronze trophy
    Paul O'B's Avatar
    Join Date
    Jan 2003
    Location
    Hampshire UK
    Posts
    40,389
    Mentioned
    180 Post(s)
    Tagged
    6 Thread(s)
    See the faq on 100% height because it is unlikely that you want your container to be only 100% high. You more than likely will want it to be a minimum of 100%. The faq explains this .


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
  •