CSS padding-inline Property

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

What You’ll Learn

The padding-inline property is a logical CSS shorthand for inner spacing on the inline-start and inline-end sides of an element. In normal horizontal English layouts, that usually means the left and right padding.

01

Logical Padding

Inline-start and inline-end.

02

Shorthand

One or two values.

03

One Value

Same padding both sides.

04

Two Values

Start then end.

05

RTL Support

Adapts to text direction.

06

padding-block

Block-axis shorthand pair.

Introduction

The padding-inline property in CSS is a shorthand property that sets the padding for the inline start and inline end edges of an element. Unlike traditional padding properties, which are based on the physical left and right sides of an element, padding-inline is logical and adapts to the text direction of the document.

This makes it particularly useful for internationalization, as it automatically adjusts for languages that read from right to left.

Definition and Usage

Apply padding-inline when you need horizontal inner spacing that follows the inline axis instead of fixed physical left and right edges. Use a single value for equal inline-start and inline-end padding, or two values when each side needs a different amount.

Like regular padding, padding-inline 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

For a simple left-to-right page, padding-inline: 20px 10px; looks like 20px left padding and 10px right padding. In RTL, those values swap sides automatically so spacing still follows the text flow.

LTR → inline-start is left RTL → inline-start is right

📝 Syntax

The syntax for the padding-inline property allows you to set the padding for the inline start and end in one declaration. You can use either one or two values.

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

element {
  padding-inline: start-value end-value;
}
  • Single value — Sets the same padding for both inline start and inline end.
  • Two values — Sets start-value for the inline start and end-value for the inline end.

Basic Example

padding-inline.css
.example {
  padding-inline: 20px 10px;
  background-color: lightgray;
}

⚡ Quick Reference

QuestionAnswer
Initial value0
Applies toInline-start and inline-end padding sides
InheritedNo
AnimatableYes, as a length
Common useCards, buttons, text blocks, and RTL-aware horizontal spacing

🎯 Default Value

The default value of the padding-inline property is 0, meaning no padding is applied by default.

💎 Property Values

ValueExampleDescription
Lengthpadding-inline: 20px 10px;Specifies the padding in fixed units like px, em, or rem.
Percentagepadding-inline: 5%;Specifies the padding as a percentage of the containing block’s inline size.
autopadding-inline: auto;Automatically calculates the padding (rarely used in practice).
initialpadding-inline: initial;Sets the property to its default value.
inheritpadding-inline: inherit;Inherits the value from its parent element.
padding-inline: 1.25rem; padding-inline: 20px 10px; padding-inline-start: 1rem;

👀 Live Preview

Four boxes with the same content and different piln- utility classes showing increasing inline-axis inner spacing:

piln-sm
piln-md
piln-lg
piln-xl

Examples Gallery

Try the reference example with two values, a single-value form, card horizontal spacing, and a logical vs physical padding comparison.

🔢 Basic padding-inline

Start with the reference example — different padding on inline-start and inline-end.

Example 1 — Inline-Start and Inline-End Padding

In this example, we’ll set the padding for an element using the padding-inline property.

padding-inline-example.html
<style>
  .example {
    padding-inline: 20px 10px;
    background-color: lightgray;
  }
</style>

<div class="example">
  This box has 20px padding at the start and 10px padding at the end.
</div>
Try It Yourself

How It Works

The lightgray background fills the padding area, so you can see 20px space at inline-start and 10px at inline-end. In horizontal LTR English, that is left and right padding.

Example 2 — Single Value

Set equal inline-start and inline-end padding with padding-inline: 1.25rem.

padding-inline-single.css
.badge {
  padding-inline: 1.25rem;
  padding-block: 0.5rem;
  background: #dbeafe;
  border-radius: 999px;
  display: inline-block;
}
Try It Yourself

How It Works

With one value, both inline sides receive the same padding. This is a common pattern for pill badges and buttons.

🛠 Layout Patterns

Apply inline-axis padding to real components and compare logical vs physical properties.

Example 3 — Card Horizontal Spacing

Use padding-inline with padding-block for comfortable card spacing that respects text direction.

padding-inline-card.css
.card {
  padding-inline: 1.25rem;
  padding-block: 1rem;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
}
Try It Yourself

How It Works

Pair padding-inline for horizontal rhythm with padding-block for vertical rhythm. Together they replace physical padding shorthand in logical layouts.

Example 4 — Logical vs Physical Padding

Compare padding-inline with padding-left and padding-right.

padding-inline-logical.css
/* Logical — follows text direction */
.logical {
  padding-inline: 24px 12px;
}

/* Physical — fixed to left and right */
.physical {
  padding-left: 24px;
  padding-right: 12px;
}
Try It Yourself

How It Works

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

padding-inline vs padding, padding-block & side properties

The padding shorthand sets all four sides at once using physical edges. Use padding for simple layouts that always use horizontal LTR writing.

padding-block controls block-start and block-end padding (usually top and bottom in English). When you need per-edge inline-axis control, use padding-inline-start, padding-inline-end, or the physical pair padding-left and padding-right.

padding-inline-companion.css
/* Logical inline-axis spacing */
.card {
  padding-inline: 1.25rem;
  padding-block: 1rem;
}

/* Physical fallback for older browsers */
.legacy-card {
  padding-left: 1.25rem;
  padding-right: 1.25rem;
}

♿ Accessibility

  • Improve readability — Text blocks benefit from inline-axis padding so lines do not touch container side edges.
  • Size touch targets — Pair inline padding with block padding on buttons and links for comfortable tap areas.
  • Respect text direction — Logical padding keeps spacing correct for RTL and multilingual users.
  • Do not hide content — Very large inline 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-inline Works

1

The browser finds inline-start and inline-end

Text direction and writing mode decide which physical edges are inline-start and inline-end.

Text direction
2

You set one or two padding values

Write padding-inline: 20px 10px; or a single value for both sides.

CSS rule
3

Browser adds space on inline sides

Padding is inserted between the content edge and the border on inline-start and inline-end.

Box model
=

Adaptable inline-axis spacing

Your layout keeps correct horizontal spacing when text direction changes.

Browser Compatibility

The padding-inline property is supported in most modern browsers, including Chrome, Firefox, Safari, Edge, and Opera. For the best user experience, especially when supporting international audiences, it is recommended to test the property across different browsers and devices.

Baseline · Modern browsers

Logical inline padding in today’s browsers

Chrome, Firefox, Safari, Edge, and Opera support padding-inline in current versions.

96% Modern browser support
Google Chrome 69+ · Desktop & Mobile
Full support
Mozilla Firefox 41+ · Desktop & Mobile
Full support
Apple Safari 12.1+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 56+ · Modern versions
Full support
padding-inline property 96% supported

Bottom line: Use padding-inline confidently in modern projects. For older browsers, fall back to padding-left and padding-right.

Conclusion

The padding-inline property is a versatile tool for web developers who need to manage the layout of elements in a way that respects text direction and internationalization.

By using logical properties like padding-inline, you can create more adaptable and user-friendly designs that work well in various language contexts. Experiment with different padding values to see how they can improve the layout and readability of your content.

💡 Best Practices

✅ Do

  • Use padding-inline for horizontal rhythm in logical layouts
  • Pair with padding-block for full logical spacing
  • Prefer rem or em for scalable inline-axis spacing
  • Use two values when inline-start and inline-end need different amounts
  • Test in RTL mode for international layouts

❌ Don’t

  • Confuse padding-inline with margin-inline
  • Assume padding-inline always means left and right in every writing mode
  • Forget that percentage padding is based on inline size
  • Mix logical and physical padding on the same element without reason
  • Skip fallbacks when supporting very old browsers

Key Takeaways

Knowledge Unlocked

Five things to remember about padding-inline

Use these points when spacing content along the inline axis.

5
Core concepts
0 02

Default 0

No spacing.

Default
1|2 03

Shorthand

One or two values.

Syntax
RTL 04

Text direction

Adapts logically.

i18n
lr 05

Not left/right

Logical vs physical.

Companion

❓ Frequently Asked Questions

The padding-inline property is a shorthand that sets padding on the inline-start and inline-end sides of an element. In horizontal left-to-right writing, those are usually the left and right padding.
The default value is 0, meaning no inline-axis inner spacing is applied unless you set padding-inline explicitly.
padding-left and padding-right always target physical left and right edges. padding-inline follows the text direction, so it stays correct when the document uses RTL languages like Arabic or Hebrew.
Yes. With two values, the first applies to inline-start and the second to inline-end. With one value, both sides use the same padding.
Use padding-inline when building layouts that support multiple languages, RTL text, or logical CSS systems that pair with properties like inline-size and padding-block.

Practice in the Live Editor

Open the HTML editor, try different padding-inline values, and see how inline-axis 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