|
December 26, 2000 Physical Measurements Tips: December 2000
Yehuda Shiran, Ph.D.
|
|
The browser-independent W3C Standard's way to set and get an element's position is via the STYLE object's left and top properties. These properties denote physical measurements. Physical measurements are used either in HTML's STYLE attribute or in JavaScript. In HTML, they are numeric properties. Numeric properties comprised of a number, followed by units of measure. The following numeric properties are example values of the left and top properties: 50px, 32px, and 0px.
Here is an example of specifying the STYLE attribute with numeric properties:
As JavaScript does not support the "numeric property" data type, these measurements become strings when you extract them into JavaScript variables. The string includes a number followed by the string
The browser won't complain if you omit the
The browser assumes the unit of measure is pixels and will add the
People who read this tip also read these tips: Look for similar tips by subject: |