CSS left Property
Example
.example1 {
left: auto;
width: 150px;
height: 150px;
border: 5px solid black;
}
.example2 {
position: absolute;
left: 150px;
width: 150px;
height: 150px;
border: 5px solid black;
}
Hello World!
Meaning
The left property defines the x (horizontal) coordinate for a positioned element, relative to the left side of the containing element or browser window.
Default value: | auto |
Inherited: | No |
Animatable: | Yes |
Version: | CSS2 |
JavaScript syntax: |
|
Standard Syntax
left: auto|length|%|initial|inherit|revert|revert-layer|unset;
Browser Support
The numbers in the table specify the first browser version that fully supports the property.
Status
Property Values
The following table describes the values of this property.
Value | Description |
---|---|
auto | This is default value. The browser calculates the left edge position. |
length | Specifies the offset as a length value in px, pt, cm, em, etc. Negative length values are allowed. |
%(percentage) | Specifies the offset in percentage. The percentage is calculated with respect to the width of the element's containing block. Negative percentage values are allowed. |
initial | Sets this property to its default value. |
inherit | If specified, the associated element takes the computed value of its parent element animation-delay property. |
revert | Reverts the cascaded value of the property from its current value to the value the property |
revert-layer | Rollback styles to the ones specified in previous cascade layers. |
unset | Resets a property to its inherited value if the property naturally inherits from its parent, and to its initial value if not. |
Default CSS Property Values
selectors {
left: auto;
}