CSS left property
Example
Set the image's left edge 5 pixels to the right of its containing element's left edge:
img
{
position:absolute;
left:5px;
}
Try it »
Property definition and usage
The left property specifies the left edge of an element. It defines the offset between the left margin edge of a positioned element and the left edge of its containing block.
If the "position" property is "static", setting the "left" property has no effect.
Note: If "position:static", the left property has no effect.
| Default value: | auto |
|---|---|
| Inherited: | no |
| Version: | CSS2 |
| JavaScript syntax: | object.style.left="50px" |
Browser support
The numbers in the table indicate the first browser version that supports this property.
| property | |||||
|---|---|---|---|---|---|
| left | 1.0 | 5.5 | 1.0 | 1.0 | 5.0 |
Attribute values
| Value | Description |
|---|---|
| auto | Default. The left edge position is calculated by the browser. |
| % | Sets the left position as a percentage of the containing element. Negative values are allowed. |
| length | Sets the left position of the element using units such as px, cm, etc. Negative values are allowed. |
| inherit | Specifies that the left property should be inherited from the parent element. |
Related Articles
CSS Tutorial: CSS Positioning