CSS left property

CSS left

CSS left property is used to specify the horizontal position of an element.

Depending on the parent container, CSS left property works differently,

  • If the position is absolute or fixed, the left property denotes the space between the containers left end and the elements left end.
  • If the position is relative, the left property denotes that the element is moved to the right side from the given position.
  • If the position is sticky, and if the element is inside the container it acts similar to relative, else if it is outside the container it works similar to the fixed.
  • If the position is static, the left property has no effect on the element.

Example

Try Yourself