ScanSkill

left

The left adjusts the horizontal position of the element. The position of the element should be defined and its value must be absolute, fixed, relative, or sticky otherwise left property will have no effect.

  • If the element's position is set to absolute or fixed, the left property sets the distance between the element's left edge and the left edge of its parent element block.
  • When position is set to relative, the left property moves the element from its left edge from its normal position.
  • When position is set to sticky, the left property behaves position: relative when the element is inside the viewport, and like position: fixed when it is outside.

Syntax

left: auto | value;

Example

 .div-2 {
            padding: 10px;
            background-color: yellow;
            position: relative;
            left: 10px;
        }
left

Property Values

auto: automatically sets the position from the left edge. (Default value)

value: sets the given length value as the position from the left edge.