CSS left Property

Description

The left property specifies the distance from the element's left outer margin to the left edge of the content block.

Initial value
auto
Applies to
Positioned elements
Inherited
No
Media
Visual
Computed value
If specified as a length, the corresponding absolute length; if specified as a percentage, the specified value; otherwise, 'auto'
Animatable
Yes
CSS Version
CSS2, CSS3
JavaScript syntax
object.style.left

Syntax

Formal syntax: auto | <length> | <percentage>

left: 20px;
left: 10%;
left: auto;

Values

  • <length>Floating-point number, followed by an absolute units designator (cm, mm, in, pt, or pc) or a relative units designator (em, ex, or px).
  • <percentage>Integer, followed by a percent sign (%). The value is a percentage of the height of the parent object.
  • autoDefault position, according to the regular HTML layout of the page.

Example

.class {
   display: block;
   position: absolute;
   top: 50px; 
   right: 100px; 
   bottom: 50px; 
   left: 100px;
}

Browser Support

Desktop
Explorer Edge Chrome Firefox Opera Safari
5.5121151
Tablets / Mobile
Android Chrome Firefox Opera Safari Samsung
1184Yes1Yes