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

    Join Date
    Nov 2001
    Posts
    212
    Rep Power
    13

    CSS Table Positioning


    Does anybody know how I can do this? I've tried tons of different settings and I can't figure it out.

    I want to position the layer with the small table based off the top left of my main table on my site, instead of absolute positioning from the top right of the browser. I want to center my entire page in the window but if I use absolute positioning it won't load in the right place for people with different resolutions.

    Here are my current settings:

    Code:
    <div id="Layer1" style="position: absolute; left: 50; top:40;">
    <table width="200">
      <tr>
        <td>small table over top of main table</td>
      </tr>
    </table>
    </div>
    
    <table width="700">
      <tr>
        <td>main table</td>
      </tr>
    </table>
    </div>
    Any help would be greatly appreciated.
  2. #2
  3. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Not exactly sure this is what you had in mind:

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <title>untitled</title>
    <style type="text/css">

    body {
    text-align: center;
    }

    </style>
    </head>
    <body>
    <div id="container">
    <div id="Layer1" style="position:absolute;">
    <table width="200" border=1 bgcolor=pink>
    <tr>
    <td>small table over top of main table</td>
    </tr>
    </table>
    </div>

    <table width="700" height=500 border=1 bgcolor=tan>
    <tr>
    <td>main table</td>
    </tr>
    </table>
    </div>
    </div>
    </body>
    </html>

    The container div sets up a 'positioning context' for the other divs. If you don't specify left & top for an absolutely positioned element, it will actually be positioned relative to its containing element (although taking up no space in the document flow).

    http://glish.com/css/
  4. #3
  5. No Profile Picture
    Senior Citizen
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2001
    Location
    leftcoast
    Posts
    2,019
    Rep Power
    16
    Am I the only one who thinks multiple-forum-gang-posting is a form of spam? Or at least a more sophisticated form of cross-posting?

    http://www.codingforums.com/showthre...threadid=11388

    John - good work!
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2001
    Posts
    212
    Rep Power
    13
    OK...adios...you busted me.

    I also posted this question in one other forum and out of three forums your solution was the only one that worked.

    Thanks for helping me out though.

IMN logo majestic logo threadwatch logo seochat tools logo