CSS

CSS Intro

CSS Intro Quiz

CSS Intro Exercise

CSS Basic

CSS Basic Quiz

CSS Basic Exercise

CSS Advance

CSS Advance Quiz

CSS Advance Exercise

CSS3

CSS3 Quiz

CSS3 Exercise

CSS Properties

CSS Functions

CSS Selectors

CSS left Property

CSS left Property

 

 

The left property is used to change the horizontal position of a positioned element. It does not work on non-positioned elements.

  1. If position is absolute or position is fixed then the left property sets the left edge of an element to a unit to the left of the left edge of its nearest positioned ancestor.
  2. If position is relative then the left property sets the left edge of an element to a unit to the left/right of its normal position.
  3. If the position is sticky then the left property behaves like its position is relative when the element is inside the viewport, and like its position is fixed when it is outside.
  4. If the position is static then the left property has no effect.

 

Default Value:-

 

Its default value is auto.

 

Syntax:-

 

Its syntax is:- left: auto | length | initial | inherit;

 

Further Explanation:-

Value Description
auto Lets the browser calculate the left edge position.
length Sets the left edge position in px, cm, etc.
% Sets the left edge position in % of containing element.
initial Sets this property to its default value.
inherit Inherits this property from its parent element.

Code Explanation

All Tutorials related to CSS Properties

All Sections related to CSS