Results 1 to 2 of 2

Thread: help with divs

  1. #1
    Join Date
    Nov 2007
    Posts
    4
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question help with divs

    Hi there, can someone help me out, I'm trying to make a div that goes from top to bottom of the page it starts on the very top and ends at the very bottom (I think it can be archieved with absolute positioning, but is it going to mess with my alignment? since it is centered in the page)

    Example:

    Code:
     _____________
    |   |     |   |
    |   |     |   |
    |   |     |   |
    |   | DIV |   |
    |   |     |   |
    |   |     |   |
    |___|_____|___|
    Thank you in advance

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Absolute positioning is generally a bad idea for such a major page element. In quirksmode you can set an element's height to 100% and it will fill the window:

    Code:
    <html>
    <head>
    <title></title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    body {
    text-align:center;
    margin:0;
    padding:0;
    }
    #main {
    width:85%;
    height:100%;
    background-color:gray;
    margin:0 auto;
    }
    </style>
    </head>
    <body>
    <div id="main"></div>
    </body>
    </html>
    But in standards mode (same basic code as above with a valid URL DOCTYPE) you cannot. It will only be as high as the content within it.
    Last edited by jscheuer1; 12-20-2007 at 05:59 PM. Reason: add details
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

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
  •