DHTML Lab - DHTML Diner - Element Page Coordinates, Part 4 | 4 | WebReference

DHTML Lab - DHTML Diner - Element Page Coordinates, Part 4 | 4

Determining Element Page Coordinates, Part 4
IE Win - Final Comments

Bordered Static Elements with Width/Height


This time the red square is nested in a static element that has a width value.

Move the blue square.


<P STYLE="border:5px green solid;
    <IMG ID="redbox"
         WIDTH="200" HEIGHT="200">


By adding a width (or height) value to the P element, we have given it "layout" properties.

In the IE5+ scheme of things this means that the element also defines a co-ordinate system and is part of the page's element offset hierarchy.
This is discussed in the MSDN documentation in the section Size, Layout, and Location of Elements.

Therefore, in IE5+, our position calculations are incorrect in both directions.

Let's try the example with a positioned element.

Produced by Peter Belesis and

All Rights Reserved. Legal Notices.
Created: Nov 21, 2002
Revised: Nov 21, 2002

URL: http://www.webreference.com/dhtml/diner/realpos4/4.html

Justtechjobs.comFind a programming school near you

Online Campus Both