www.webdeveloper.com
Results 1 to 3 of 3

Thread: difference between relative and absolute position

  1. #1
    Join Date
    Jan 2004
    Posts
    16

    difference between relative and absolute position

    hi,
    what is the difference between absolute and relative positioning in DHTML?
    Thnx

  2. #2
    Join Date
    Dec 2003
    Location
    London, UK
    Posts
    107
    The absolute position of an element is it's position relative (ugh! but true) to the parent's origin.

    The relative position of an element is it's position relative the position it would have been in had it not been positioned at all.

    Have a look at this:

    <div id="divA" style="position:absolute: left:100; top:50;">
    Hello.
    How are you?.
    Goodbye
    </div>

    and compare to this:

    <div id="divA" style="position:absolute: left:100; top:50;">
    Hello.
    <span id="spanB" style="position:relative: left:10; top:20;">
    How are you?.
    </span>
    Goodbye
    </div>

  3. #3
    Join Date
    Jan 2004
    Posts
    16
    Thank you

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles