CSS padding-left Property

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

Definition and Usage

The padding-left property sets the width of the padding area on the left of an element. That space sits between the content and the left border.

It always targets the physical left edge. For spacing that follows text direction, use padding-inline-start. To set all sides at once, use the padding shorthand.

Standard-track.

Not deprecated and not experimental. A long-standing CSS box-model property with universal browser support.

CSS Syntax

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

Lengths and percentages must be non-negative. The initial value is 0.

Property Values

ValueDescriptionTry it
<length>Fixed padding such as 20px, 1rem, or 2emTry it
<percentage>Percent of the containing block’s widthTry it
initialResets to 0Try it
inheritTakes the parent’s padding-leftTry it

How to Use padding-left

Add space inside the left border when you specifically need the physical left side.

  1. Choose a non-negative length or percentage.
  2. Set it on the element that needs left inner space.
  3. Remember: padding is inside the border; margin is outside.
  4. Use padding-inline-start instead when the layout must work in RTL too.
PieceRequired?Role
Element that accepts paddingYesSome table display types ignore padding
Length or percentageYesMust be 0 or greater
Containing block widthFor %Percentage resolves against the parent width
Border (optional)HelpfulMakes the left padding gap easy to see

Live Preview

Change padding-left on a bordered box. The gap always appears on the physical left.

Padding sits between the content and the left border. It does not move the border itself.

Box
Left padding here

padding-left: 2rem

CSS Examples

Each snippet focuses on padding-left. Use Try It Yourself for a live editor.

Example 1 — Length Padding

Add 2rem of space between the content and the left border.

CSS
<style>
  div {
    padding-left: 2rem;
    border: 1px solid black;
  }
</style>

<div>Left padding here</div>
Try It Yourself

How It Works

  1. Pick a length. 2rem is the left inner gap.
  2. Physical left only. The gap stays on the left even if text direction is RTL.
  3. Content shifts right. Text starts after that 2rem space.
  4. Border stays outside. Padding sits between content and the border edge.

Example 2 — Percentage Padding

Size left padding as a share of the parent width.

CSS
<style>
  div {
    padding-left: 10%;
    border: 1px solid black;
  }
</style>

<div>10% left padding</div>
Try It Yourself

How It Works

  1. Use a percentage. 10% is relative to the containing block’s width.
  2. Not the element height. Horizontal padding percentages still use width.
  3. Wider parent, larger padding. The gap scales when the parent grows.
  4. Still non-negative. Negative percentages are invalid for padding.

Example 3 — Zero vs Padded

Compare no left padding with a clear 2rem gap.

CSS
<style>
  .none {
    padding-left: 0;
    border: 1px solid black;
  }

  .pad {
    padding-left: 2rem;
    border: 1px solid black;
  }
</style>

<div class="none">No left padding</div>
<div class="pad">2rem left padding</div>
Try It Yourself

How It Works

  1. Default is zero. With 0, content sits against the left border.
  2. Add a gap. 2rem pushes the content inward from the left.
  3. Same border, different padding. Only the inner space changes.
  4. Not margin. The outer position of the box stays the same; only the inside shifts.

Edge Cases & Pitfalls

Most padding bugs come from mixing it with margin or logical properties.

margin

Padding is inside; margin is outside

padding-left pushes content away from the left border. margin-left pushes the whole box away from its neighbor.

rtl

Physical left ignores text direction

In RTL layouts, padding-left still pads the left edge. Prefer padding-inline-start for start-of-text spacing.

negative

Negative values are invalid

Padding cannot be negative. Use a negative margin if you need to pull an element outward.

percent

Percentage uses the parent width

10% is 10% of the containing block’s width, not the element’s height.

box

box-sizing changes the total size

With border-box, left padding is included inside the declared width. With content-box, it adds outside the content width.

Browser Support

padding-left is a browser layout property. Node.js, Deno, and Bun do not apply it.

✓ Baseline · Widely available

padding-left

Length and percentage values work in all major browsers, including older Internet Explorer versions.

99% Common values
Google Chrome 1+
Full
Mozilla Firefox 1+
Full
Apple Safari 1+
Full
Microsoft Edge 12+
Full
Opera Supported
Full
Samsung Internet Supported
Full
Internet Explorer 4+
Full
padding-left Widely supported

Bottom line: Safe for everyday left padding in every current browser.

Key Takeaways

  • Role: add inner space on the physical left edge, between content and border.
  • Common values: lengths and percentages (never negative).
  • Initial value: 0. Not inherited.
  • RTL tip: use padding-inline-start when spacing should follow text direction.

One line: padding-left is physical left inner space — always left, never negative.

Frequently Asked Questions

It sets inner spacing on the left edge of an element, between the content and the left border.
The initial value is 0. No left padding is added until you set a length or percentage.
padding-left adds space inside the border. margin-left adds space outside the border, between this element and its neighbor.
padding-left always targets the physical left edge. padding-inline-start follows writing mode and direction, so it stays on the start of the text flow in LTR and RTL.
Yes. A percentage is relative to the containing block's width (its inline size in horizontal writing). Values cannot be negative.
It is Baseline and widely available in all major browsers, including older Internet Explorer versions. It is a browser layout property, not a Node.js feature.

Next: padding-right

Learn how to set physical right inner spacing.

padding-right 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