#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    50
    Rep Power
    11

    table stretch css


    How can I set the height of a table so that it covers the browser from top to bottom regardless of resolution using css ?
  2. #2
  3. No Profile Picture
    Super Moderator
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,008
    Rep Power
    2790
    Code:
    <html>
     <head>
      <style>
       table#main
        {
          width:100%;
          height:100%;
        }
      </style>
     </head>
     <body>
    
      <table id=main>
       <tr>
        <td>foo..</td>
       </tr>
      </table>
    
     </body>
    </html>
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    50
    Rep Power
    11
    I cannot get it to work, here is my style properties,

    #mainTable
    {
    border-top-width : 1px;
    border-bottom-width : 1px;
    border-left-width : 1px;
    border-right-width : 1px;
    border-color: black;
    width: 640px;
    height : 100%;
    margin-left: auto;
    margin-right: auto;
    }


    Look here to see the pages Im working on.
  6. #4
  7. |<.+#f@#+.&.|
    Devshed Loyal (3000 - 3499 posts)

    Join Date
    Mar 2002
    Location
    norway
    Posts
    3,009
    Rep Power
    1224
    to get the % height to work you need to
    set a height to the parent element,

    like this

    Code:
    html, body {
    	height:100%;
    }
    you need the html to make it work in mozilla.
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    50
    Rep Power
    11
    Thanks a lot dude.

IMN logo majestic logo threadwatch logo seochat tools logo