style.backgroundPositionX (Property)

The X-coordinate of the background image grid position.


CSS level - Proposed
JavaScript - 1.5
JScript - 3.0
Internet Explorer - 4.0
Netscape - 6.0
Property/method value type:String primitive
JavaScript syntax:-myStyle.backgroundPositionX
CSS syntax:background-position-x: aValue
Argument list:aValueAn X coordinate value

This property defines the horizontal coordinate of the reference position for the background image relative to the left edge of the extent rectangle containing the styled element. The positioning of the image includes the padding space around the styled element.

Unlike the backgroundPosition property, the default measurement units for this property are pixels. This is the most accurate means of positioning background images. You can also use the value "left" to equate symbolically to the value 0.

Example code:

   // Example background positionX assignments
   myStyle.backgroundPositionX = "left";
   myStyle.backgroundPositionX = "20";
   myStyle.backgroundPositionX = "50%";
   myStyle.backgroundPositionX = "0";

See also:Measurement units, style.background