Click to See Complete Forum and Search --> : difference between relative and absolute position


vcorn4
01-10-2004, 01:16 AM
hi,
what is the difference between absolute and relative positioning in DHTML?
Thnx

pnaj
01-10-2004, 09:07 AM
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>

vcorn4
02-02-2004, 01:51 AM
Thank you