This page is Almost Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.

posLeft

Summary

Reflects the value of the Cascading Style Sheets (CSS) left attribute for positioned items.

Property of css/cssom/propertiescss/cssom/properties

Syntax

var result = element.posLeft;
element.posLeft = value;

Examples

This example uses the posLeft property to move the first img object left by 10 units.

<SCRIPT LANGUAGE="JScript">
document.all.tags("IMG").item(0).style.posLeft -= 10;
</SCRIPT>

This example uses a timer to change the value of the posLeft in increments of 10.

<SCRIPT LANGUAGE="JScript">
function moveThis()
{
:
    if (sphere.style.posLeft<900) {
        sphere.style.posTop += 2;
        sphere.style.posLeft += 2;
        window.setTimeout("moveThis();", 1);
        }
}
:
</SCRIPT>

View live example

Notes

Remarks

This property reflects the value of the Cascading Style Sheets (CSS) left attribute for positioned items. This property always returns zero for nonpositioned items because “left” has meaning only when the object is positioned. If the left attribute is not set, the posLeft property returns zero. Use the offsetLeft property to calculate actual positions within the document area. Setting this property changes the value of the left position but leaves the units designator for the property unchanged. Unlike the left property, the posLeft property value is a floating-point number, not a string.

See also

Related pages

Attributions