CSS left Property

Beginner
5 min read
Updated: Oct 2026
3 examples
Live preview

Definition and Usage

The left property sets the horizontal inset of a positioned element toward or away from the physical left edge. It has no effect when position is static.

For absolute or fixed, it is the distance from the containing block’s left edge. For relative, it moves the box to the right of its normal spot. The initial value is auto. It is not inherited. Prefer inset-inline-start when the offset should follow writing direction.

Baseline for lengths, percentages, and auto.

Not deprecated. Study those values first. Newer anchor() / anchor-size() forms for left have limited support — skip them until you need anchor positioning.

CSS Syntax

syntax.css
left: auto | <length> | <percentage> | initial | inherit;

Examples: left: auto; · left: 20px; · left: 10%; · left: 0;

Property Values

ValueDescriptionTry it
autoBrowser chooses based on right, width, and flow. Initial valueTry it
<length>Fixed offset such as 20px or 2em. May be negativeTry it
<percentage>Percent of the containing block’s widthTry it
0Flush with the left edge (for absolute/fixed)Try it
initialResets to autoTry it
inheritInherits from the parent elementTry it

How to Use left

Position the element first, then set how far it sits from the left.

  1. Set position to relative, absolute, fixed, or sticky.
  2. For absolute children, give a parent position: relative (or another non-static value) as the containing block.
  3. Set left to a length, percentage, or 0.
  4. Add top / right / bottom as needed, or use inset.
PieceRequired?Role
Non-static positionYesWithout it, left does nothing
Containing blockFor absoluteNearest positioned ancestor (or the viewport for fixed)
left valueYes (to control offset)Length, percentage, or auto
right tooOptionalCan stretch the box; if both fight, left wins in LTR

Live Preview

The blue box is position: absolute. Only left changes.

Parent is position: relative. The box also has top: 16px so you can see the horizontal move clearly.

Positioned box

left: 20px

CSS Examples

Each snippet focuses on left. Positioning is only there so the offset can show. Use Try It Yourself for a live editor.

Example 1 — Absolute Offset

Pin a box 20px from the left of a relative parent.

CSS
<style>
  .box {
    position: relative;
  }

  .pin {
    position: absolute;
    left: 20px;
    top: 16px;
  }
</style>

<div class="box">
  <div class="pin">Pinned</div>
</div>
Try It Yourself

How It Works

  1. Make a containing block. position: relative on the parent anchors absolute children.
  2. Take the child out of flow. position: absolute lets insets apply.
  3. Set the offset. left: 20px is the lesson — 20px from the parent’s left edge.
  4. Add top for clarity. Vertical placement is separate from left.

Example 2 — Relative Nudge

Shift an in-flow box to the right of its normal position.

CSS
<style>
  .nudge {
    position: relative;
    left: 24px;
  }
</style>

<p>Before</p>
<p class="nudge">Nudged right</p>
<p>After</p>
Try It Yourself

How It Works

  1. Keep the element in flow. position: relative still reserves the original space.
  2. Offset visually. left: 24px moves the painted box to the right.
  3. Neighbors stay put. “Before” and “After” do not close the gap the box left behind.
  4. Opposite of absolute. Relative nudges; absolute places against a containing block.

Example 3 — Percentage Left

Offset by a fraction of the containing block’s width.

CSS
<style>
  .box {
    position: relative;
  }

  .pin {
    position: absolute;
    left: 50%;
    top: 16px;
  }
</style>

<div class="box">
  <div class="pin">50%</div>
</div>
Try It Yourself

How It Works

  1. Same absolute pattern. Parent is relative; child is absolute.
  2. Use a percentage. left: 50% is half the parent’s width from the left edge.
  3. Not centered by itself. The box’s own width still sticks out past the midpoint unless you also translate it.
  4. Scales with the parent. Wider containers move the inset farther in pixels.

Edge Cases & Pitfalls

If left seems ignored, one of these is usually why.

static

Needs a non-static position

left on a static element does nothing. Set position to relative, absolute, fixed, or sticky.

parent

Absolute needs a containing block

Without a positioned ancestor, absolute left is measured from a higher ancestor (often the initial containing block), which surprises beginners.

both

left and right together

Setting both can stretch the element. If width cannot satisfy both, left wins in left-to-right layouts.

relative

Relative left moves right

On a relatively positioned box, a positive left shifts the element toward the right of its normal position.

logical

Physical left does not flip in RTL

Use inset-inline-start when the start edge should follow writing direction.

Browser Support

left is a browser CSS property for positioned layout. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

left

Lengths, percentages, and auto are widely supported. anchor() values used with left are newer and not part of these numbers.

100% Common values
Google Chrome All versions
Full support
Mozilla Firefox All versions
Full support
Apple Safari All versions
Full support
Microsoft Edge All versions
Full support
Opera All versions
Full support
Samsung Internet All versions
Full support
Internet Explorer All versions
Full support
left Widely supported

Bottom line: Safe for auto, px, em, rem, and percentages on positioned elements. Treat anchor() as progressive. It is not a runtime API.

Key Takeaways

  • Role: horizontal inset from the physical left for positioned elements.
  • Initial value: auto. Not inherited.
  • Needs position: ignore left on static elements.
  • Logical option: use inset-inline-start for direction-aware layouts.

One line: left places a positioned box from the left — after position is already not static.

Frequently Asked Questions

It sets the horizontal inset of a positioned element relative to the left side. Absolute and fixed use the containing block; relative offsets from the normal position.
The initial value is auto. The browser then follows other rules such as right, width, and normal flow.
No. left has no effect on static elements. Use relative, absolute, fixed, or sticky.
Yes. Percentages refer to the width of the containing block.
left is always the physical left edge. inset-inline-start follows writing direction and can map to the right side in RTL.
It is Baseline and widely available for lengths, percentages, and auto. Newer anchor() values have limited support. It is a browser CSS property, not a Node.js feature.

Next: letter-spacing

Learn how to adjust space between characters with letter-spacing.

letter-spacing tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful