Style left Property
The Style object
Definition and Usage
The left property sets or returns the left position of a positioned element.
This property specifies the left position of the element, including: padding, scrollbar, border and margin.
**Tip:** A positioned element is an element whose position property is set to: relative, absolute, or fixed.
Syntax
Sets the left property:
Object.style.left="auto|
length
|
%
|inherit"
Returns the left property:
Object.style.left
| Value | Description |
|---|---|
| auto | Default. The left position is calculated by the browser. |
| length | Defines the left edge of the element relative to the left edge of the nearest positioned ancestor, using units such as px, cm, etc. Negative values are allowed. |
| % | Defines the left edge of the element as a percentage of the left edge of the nearest positioned ancestor. |
| inherit | The left property value is inherited from the parent element. |
Browser support





All major browsers support the left property.
**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 supports "inherit" only if a !DOCTYPE is specified. IE9 supports "inherit".
Example
Example
Sets the left position of a button:
Try it »
The Style object