Click to See Complete Forum and Search --> : Using layers (relative)


dcjones
10-10-2003, 10:18 AM
Hi all,

I know this sounds odd but I am trying to understand how to use layers using both the absolute and relative setting. I understand the absolute setting but not the relative.

If I use LAYERS in a document and set the style to the following:

<div id="Layer1" style="position:relative; width:374px; height:115px; z-index:1; left: 330px; top: 177px;">

What is the layer relative to.

Does this make sense.

Regards

Dereck

jbergthorson
10-10-2003, 11:07 AM
position:absolute
If you define the position to be absolute it will be calculated from the upper left corner of the page - unless the layer is defined inside another layer, in which case it will be calculated from the upper left corner of the parent layer.

position:relative
If you define the position to be relative it will be relative to the position of the tag that carries the style.
That is, if you add a relatively positioned layer in the middle of the page, then the position will be calculated from that exact spot in the middle of your page where it was added.

i answered this in the html forum