Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

CSS left property


May 05, 2021 CSS Reference Manual


Table of contents


CSS left property


Set the left edge of the image 5 pixels to the right on the left edge of its containing element:

img
{
position:absolute;
left:5px;
}

Try it out . . .

Description of property definition and use

The left property specifies the left edge of the element. This property defines the offset between the left margin boundary of the anchor element and the left boundary of the block it contains.

If the value of the "position" property is "static," setting the "left" property has no effect.

Note: If "position:static", the left property has no effect.

Default: auto
Inherited: no
Version: CSS2
JavaScript syntax: object .style.left="50px"


Browser support

The numbers in the table support the first browser version number of the property.

Attributes
left 1.0 5.5 1.0 1.0 5.0

The property value

Value Describe
auto The default. The position of the left edge is calculated from the browser.
% Sets the left position as a percentage of the included elements. Negative values can be used.
length Use units such as px, cm, etc. to set the left position of the element. Negative values can be used.
inherit Specifies that the value of the left property should be inherited from the parent element.


Related articles

CSS tutorial: CSS Positioning