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 3 of 3

Thread: CSS Position

  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    84
    Thanks
    10
    Thanked 0 Times in 0 Posts

    CSS Position

    Hi, i am simply trying to alert the left position of a css layer.

    Javascript:
    Code:
    var Element = document.getElementById('box');
    alert(Element.style.left);
    CSS
    Code:
    #box {position:absolute;
    left:150px;
    top:150px;
    background-color:blue;
    height:100;
    width:100;}
    HTML
    Code:
    <div id="box">
    </div>
    The problem is the alert is blank and i can't understand why.

    thanks

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,851
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    The problem is the alert is blank and i can't understand why.
    See http://blog.stchur.com/2006/06/21/css-computed-style/
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    New Coder
    Join Date
    Aug 2009
    Posts
    84
    Thanks
    10
    Thanked 0 Times in 0 Posts
    Thanks i understand now.


  •  

    Posting Permissions

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