Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: table position

  1. #1
    New to the CF scene
    Join Date
    Jul 2002
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile table position

    is there a way to determine a table's position? I'm generating dynamic tables on top of layers using <div>, so i need to know the position of certain tables relative to the browser window. Like if its possible to find how many pixels the table is from the left and top edges of the browser.

    Thanks!

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    North East England
    Posts
    853
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can determine the <div's position using absolute positioning like so...

    <style>
    div#bob{
    position: absolute;
    top:100px;
    left100px
    }
    </style>

    <div ID="bob">content</div>


    OR

    <div style="position:absolute;top:100px;left:100px">content<div>

    Either giving the same result; a layer 100 pixels from both top and left. The first would enable you to define the co-ordinates through an external *.css file or through styling in the headers.
    [+] Computer/PC issues [+] Silverpaw3D
    ------------------------------------------------
    Never buy a dwarf with learning disabilities...

    ...it's not big, and it's not clever.

  • #3
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #4
    Regular Coder
    Join Date
    Jun 2002
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    This might give you a better idea

    <html>
    <head>
    <title></title>
    <script>
    onload = function() {
    var top = document.getElementById("table").offsetTop;
    var left = document.getElementById("table").offsetLeft;
    alert("left "+left+" px");
    alert("top "+top+" px");
    }
    </script>
    </head>
    <body>
    <table id="table" border="1">
    <tr>
    <td></td>
    </tr>
    </table>
    </body>
    </html>


  •  

    Posting Permissions

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