CSS Property: left

The left property in CSS specifies the horizontal position of an element relative to its containing element. It is commonly used with absolute or fixed positioning to move an element to a specific location on the page.

The value for the left property can be defined using various units such as pixels, percentages, or ems.

Syntax:


selector {
    left: value;
}

Where selector is the CSS selector for the element you want to style, and value is the horizontal position you want to set.

Examples:

Result:

This is an example of using the left property with a value of 50px.

In the above example, the element has been moved 50 pixels to the right of its original position using the left property.

Result:

This is an example of using the left property with a value of 25%.

In this example, the element has been moved 25% to the right of its containing element's width.

Summary:

Value Description
pixels Specifies the position in pixels.
percentage Specifies the position as a percentage of the containing element's width.
ems Specifies the position in em units.