CSS padding-left Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Box Model & Spacing

What You’ll Learn

The padding-left property sets inner spacing on the left edge of an element. Padding adds space inside an element, which can help improve the visual layout and readability of your content.

01

Left Edge Only

One physical side.

02

Syntax

Single value.

03

Units

px, em, rem, %.

04

Box Model

Inside the border.

05

Default 0

No spacing by default.

06

padding

Four-side shorthand.

Introduction

The padding-left property in CSS is used to define the amount of space between the content of an element and its left border. Padding adds space inside an element, which can help improve the visual layout and readability of your content.

This property is part of the CSS box model, which also includes margins, borders, and content.

Definition and Usage

Apply padding-left when you need extra room to the left of the content inside an element — for example, indenting a paragraph, offsetting text beside an icon, or adding space inside a card before the left border.

Like all padding properties, padding-left increases the visible size of an element’s background and border box. It never collapses and always stays inside the element’s border.

💡
Beginner Tip

Use padding-left for inner spacing on the left. Use margin-left when you need space outside the element, between this box and the one to its left.

padding-left → space before content Always the physical left edge

📝 Syntax

The syntax for the padding-left property is simple. You specify the padding value directly within the CSS rule for the desired element.

syntax.css
element {
  padding-left: value;
}

Here, value can be specified in different units such as pixels (px), ems (em), percentages (%), or other valid CSS units.

Basic Example

padding-left.css
p {
  padding-left: 20px;
  border: 1px solid #000;
}

Syntax Rules

  • Apply padding-left to any element that needs extra inner space on the left side.
  • The value is a length, percentage, or keyword such as inherit or initial.
  • The property is not inherited — child elements do not automatically get the parent’s left padding.
  • Percentage padding is calculated relative to the width of the containing block.

⚡ Quick Reference

QuestionAnswer
Initial value0
Applies toLeft padding side only
InheritedNo
AnimatableYes, as a length
Common useParagraphs, lists, cards, and indented content beside icons

🎯 Default Value

The default value for the padding-left property is 0. This means that if no value is specified, there will be no extra space between the content and the left border of the element.

💎 Property Values

ValueExampleDescription
Lengthpadding-left: 10px;Defines a fixed amount of padding using units like px, em, or rem.
Percentagepadding-left: 5%;Defines the padding as a percentage of the containing element’s width.
inheritpadding-left: inherit;Inherits the padding value from the parent element.
initialpadding-left: initial;Resets to the initial value (0).
padding-left: 20px; padding-left: 1.5rem; padding-left: 5%;

👀 Live Preview

Four boxes with the same content and different pl- utility classes showing increasing left inner spacing:

pl-sm
pl-md
pl-lg
pl-xl

Examples Gallery

Start with the reference paragraph example, try different left values, add indent spacing in lists, and compare physical left padding with logical inline-start padding.

🔢 Basic padding-left

Start with the reference example — left padding on a paragraph with a border.

Example 1 — Paragraph with Left Padding

In this example, we’ll add a left padding of 20 pixels to a paragraph element.

padding-left-example.html
<style>
  p {
    padding-left: 20px;
    border: 1px solid #000;
  }
</style>

<p>
  This paragraph has a left padding of 20 pixels, which adds space between the content and the left border.
</p>
Try It Yourself

How It Works

The border shows the element edge, and the 20px gap appears between the left border and the text. The padding area is inside the border.

Example 2 — Different Left Values

Use rem units for scalable left spacing that grows with root font size.

padding-left-rem.css
.compact {
  padding-left: 0.5rem;
}

.comfortable {
  padding-left: 1.5rem;
}

.spacious {
  padding-left: 2.5rem;
}
Try It Yourself

How It Works

Each class sets a different left padding while leaving the right side unchanged. The background fills the padding area so you can compare the spacing visually.

🛠 Layout Patterns

Apply left padding to lists and compare physical vs logical properties.

Example 3 — List Item Indent

Add left padding to list items for a custom indented look without default bullets.

padding-left-list.css
.custom-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.custom-list li {
  padding-left: 1.25rem;
  border-left: 3px solid #2563eb;
  margin-bottom: 0.5rem;
}
Try It Yourself

How It Works

Left padding pushes text away from the colored border accent, creating a clean indented list style.

Example 4 — Physical vs Logical Left Padding

Compare padding-left with padding-inline-start.

padding-left-logical.css
/* Physical — fixed to left edge */
.physical {
  padding-left: 24px;
}

/* Logical — follows text direction */
.logical {
  padding-inline-start: 24px;
}
Try It Yourself

How It Works

In horizontal LTR English, both approaches look the same. padding-inline-start stays correct when text direction changes to RTL; physical left padding does not.

padding-left vs padding, padding-inline-start & margin-left

The padding shorthand sets padding on all four sides at once. Use padding-left when you need spacing on only the left edge.

padding-inline-start is the logical equivalent that follows the inline axis. Use padding-left for simple physical layouts; prefer padding-inline-start in multilingual or RTL designs. Remember: margin-left adds space outside the border, not inside it.

padding-left-companion.css
/* Left only */
.quote {
  padding-left: 1.25rem;
  border-left: 4px solid #2563eb;
}

/* All four sides via shorthand */
.card {
  padding: 1rem 1.5rem;
}

/* Space to the left outside the border */
.sidebar {
  margin-left: 2rem;
}

♿ Accessibility

  • Improve readability — Paragraphs and list items benefit from left padding so text does not crowd the left border.
  • Touch targets — Buttons and links inside padded containers are easier to tap when left padding gives them room.
  • RTL layouts — For multilingual sites, consider padding-inline-start instead of padding-left so spacing follows text direction.
  • Do not hide content — Very large left padding on small screens can squeeze readable text area.
  • Test zoomed layouts — Users who zoom in rely on comfortable padding to keep text readable.

🧠 How padding-left Works

1

You set a padding value

Write padding-left: 20px; with a length, percentage, or keyword.

CSS rule
2

Browser adds space on the left

Padding is inserted between the content edge and the border on the left side only.

Box model
3

Background fills the padding area

The element’s background color and background image extend into the padding box, making the gap visible.

Rendering
=

Comfortable left spacing

Content has breathing room before it without affecting spacing on other sides or outside the border.

Browser Compatibility

The padding-left property is supported in all modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. It is also compatible with older versions of these browsers, ensuring consistent behavior across different platforms.

Universal · All browsers

Left padding works everywhere

Chrome, Firefox, Safari, Edge, Opera, and Internet Explorer all support padding-left as a core box-model property.

100% Universal support
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Legacy & Chromium
Full support
Opera All versions
Full support
padding-left property 100% supported

Bottom line: padding-left is one of the most reliable CSS properties. Safe to use in any project without fallbacks.

Conclusion

The padding-left property is an essential tool for web developers looking to control the spacing within their elements.

By adjusting the left padding, you can create visually appealing layouts that enhance the user experience. Experiment with different padding values and units to see how they can improve the design of your web projects.

💡 Best Practices

✅ Do

  • Use padding-left for inner spacing on the left in LTR layouts
  • Prefer rem or em for scalable left spacing
  • Pair with border-left for quote and accent styles
  • Use the padding shorthand when all sides need spacing
  • Consider padding-inline-start for RTL-aware international layouts

❌ Don’t

  • Confuse padding-left with margin-left for outer spacing
  • Use excessive left padding that pushes content off small screens
  • Forget that percentage padding is based on width, not height
  • Rely on padding-left alone in RTL multilingual layouts
  • Use physical left padding when writing-mode-aware layouts need logical properties

Key Takeaways

Knowledge Unlocked

Five things to remember about padding-left

Use these points when spacing content on the left edge.

5
Core concepts
0 02

Default 0

No spacing.

Default
03

Inside Border

Part of box model.

Scope
% 04

Units

px, em, rem, %.

Values
pis 05

Not inline-start

Physical vs logical.

Companion

❓ Frequently Asked Questions

The padding-left property sets inner spacing on the left edge of an element, between the content and the left border. It creates horizontal room before the content inside the element.
The default value is 0, meaning no left inner spacing is applied unless you set padding-left explicitly.
padding-left adds space inside the element, between the content and the border. margin-left adds space outside the border, between this element and the element to its left.
padding-left always targets the physical left edge. padding-inline-start follows the inline axis and stays correct when text direction changes to RTL.
Yes. Percentage padding is calculated relative to the width of the containing block, even for left padding.

Practice in the Live Editor

Open the HTML editor, try different padding-left values, and see how left spacing changes your layout instantly.

HTML Editor →

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.

5 people found this page helpful