CSS scroll-padding-inline Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Logical Properties

What You’ll Learn

The scroll-padding-inline property insets the scrollport on the inline axis inside a scroll container. It is the logical companion to physical left/right scroll padding and works well with horizontal scroll snapping.

01

inline

Horizontal flow axis.

02

start

Inline-start side.

03

end

Inline-end side.

04

snap

Scroll snapping.

05

length

px, rem, %.

06

logical

Writing-mode safe.

Introduction

The scroll-padding-inline property in CSS is a shorthand property that sets the scroll padding of a scroll container in the inline dimension.

This property defines the space between the snap position and the edges of the scroll container on the inline axis (left and right in horizontal writing mode, or the corresponding sides in vertical writing modes). It is part of the CSS Scroll Snap module and helps create a better horizontal scroll snapping experience.

Definition and Usage

scroll-padding-inline is a logical shorthand for scroll-padding-inline-start and scroll-padding-inline-end. Apply it to the scroll container — such as a carousel wrapper with overflow: auto and scroll-snap-type: x mandatory.

In standard horizontal writing mode, inline-start maps to the left and inline-end maps to the right. That makes scroll-padding-inline: 2rem 1rem similar to setting left and right scrollport insets, but it stays correct if the writing mode or direction changes.

💡
Beginner Tip

On a normal English webpage, think of scroll-padding-inline as “left and right scrollport inset” that follows the document’s inline direction.

📝 Syntax

The syntax for the scroll-padding-inline property is straightforward. It can accept one or two values.

syntax.css
element {
  scroll-padding-inline: length | percentage | auto;
}
  • If one value is specified, it applies the same inset to both inline-start and inline-end.
  • If two values are specified, the first applies to inline-start and the second to inline-end.

Basic Example

scroll-padding-inline.css
.scroll-container {
  scroll-padding-inline: 20px;
}

Longhand Properties

  • scroll-padding-inline-start — inset at the inline-start edge
  • scroll-padding-inline-end — inset at the inline-end edge

Syntax Rules

  • One value sets both inline-start and inline-end equally.
  • Two values set inline-start first, then inline-end.
  • Percentages are relative to the scroll container’s inline size.
  • Set the inset on the scroll container, not on individual snap targets.

🎯 Default Value

The default value for the scroll-padding-inline property is auto, which means no extra inline-axis inset is applied unless you specify a length or percentage.

⚡ Quick Reference

QuestionAnswer
Default valueauto
Horizontal writing modeUsually left and right scrollport inset
Shorthand forscroll-padding-inline-start + scroll-padding-inline-end
Accepted valuesLengths, percentages, auto
Set onScroll containers
InheritedNo
AnimatableNo

💎 Property Values

ValueExampleDescription
lengthscroll-padding-inline: 20px;Defines a fixed inset using units like px, em, rem, etc.
percentagescroll-padding-inline: 10%;Defines inset as a percentage of the scroll container’s inline size.
autoscroll-padding-inline: auto;Lets the browser calculate the padding.
20px 2rem 1rem 10%

When to Use scroll-padding-inline

scroll-padding-inline is the right choice when inline-axis scrollport insets should follow logical layout:

  • Horizontal scroll snapping — Inset snapped panels from container inline edges.
  • Carousels — Add side breathing room on horizontal snap scrollers.
  • International layouts — Prefer logical properties over hard-coded left/right rules.
  • Side navigation — Inset inline-start so content is not hidden under fixed side UI.

For block-axis insets, use scroll-padding-block instead.

👀 Live Preview

Scroll sideways inside the panel. The container uses scroll-snap-type: x mandatory and scroll-padding-inline: 16px.

Section 1
Section 2
Section 3

The inline-axis inset creates breathing room when each panel snaps inside the horizontal scrollport.

Examples Gallery

Start with the reference horizontal scroll example, set different inline-start and inline-end values, try a horizontal snap carousel, and use scroll-padding-inline-start with a fixed side nav.

📜 Inline-Axis Scrollport Inset

Inset the scrollport on the inline axis inside a scroll container — matching the reference example.

Example 1 — scroll-padding-inline on a scroll container

In this example, we’ll add a scroll padding of 20px to the inline direction of a horizontal scroll container.

index.html
<style>
  .scroll-container {
    width: 300px;
    height: 150px;
    overflow: auto;
    scroll-padding-inline: 20px;
    border: 1px solid #ccc;
  }

  .content {
    width: 600px;
    height: 100%;
  }
</style>

<div class="scroll-container">
  <div class="content">
    Scroll sideways to see the inline padding effect.
  </div>
</div>
Try It Yourself

How It Works

scroll-padding-inline insets the scrollport on the inline axis before the browser settles each scroll or snap position.

Example 2 — Different inline-start and inline-end values

Use two values when inline-start and inline-end insets should differ: scroll-padding-inline: 2rem 1rem;.

start-end.css
.carousel {
  scroll-padding-inline: 2rem 1rem;
}
Try It Yourself

How It Works

The first value applies to inline-start; the second applies to inline-end.

🗃 Horizontal Snap Containers

Use inline-axis insets inside horizontal carousels and overflow panels.

Example 3 — Horizontal snap carousel

Combine scroll-snap-type: x mandatory and scroll-padding-inline on the same scroll container.

carousel-snap.css
.snap-box {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline: 16px;
}

.panel {
  scroll-snap-align: start;
}
Try It Yourself

How It Works

The container defines both horizontal snapping and the inline-axis scrollport inset for all child panels.

Example 4 — scroll-padding-inline-start

When only the inline-start side needs inset, use the longhand: scroll-padding-inline-start: 3.5rem;.

inline-start.css
.carousel {
  scroll-padding-inline-start: 3.5rem;
}
Try It Yourself

How It Works

Longhands let you inset only one logical side of the scrollport when the other side does not need adjustment.

scroll-padding-inline vs scroll-padding

scroll-padding is the physical shorthand for all four sides. scroll-padding-inline targets only the inline axis and is safer for multilingual layouts and RTL pages.

Pair with scroll-snap-type: x mandatory for horizontal carousels and with scroll-snap-align on each slide.

logical-vs-physical.css
/* Physical shorthand */
.physical { scroll-padding-left: 2rem; }

/* Logical equivalent in horizontal LTR writing */
.logical { scroll-padding-inline-start: 2rem; }

🧠 How scroll-padding-inline Works

1

Inline axis is determined

Writing mode and direction decide which container edges are inline-start and inline-end.

Logical
2

Scrollport edges inset

scroll-padding-inline shrinks the effective snap area on both inline edges of the container.

Inset
3

Content snaps into place

Snapped items land inside the inset scrollport instead of flush against inline edges.

Position
=

Comfortable inline-axis snaps

Snapped carousel slides stay visible, even with fixed side navigation on the inline-start side.

Browser Compatibility

The scroll-padding-inline property is supported in most modern browsers, including the latest versions of Chrome, Firefox, Safari, Edge, and Opera. However, it is always a good practice to test your website across different browsers to ensure compatibility.

Logical scroll padding · Modern support

Reliable scroll-padding-inline support

Current Chrome, Firefox, Safari, Edge, and Opera support logical scroll-padding properties.

97% Modern browser support
Google Chrome 69+ · Desktop & Mobile
Full support
Mozilla Firefox 68+ · Desktop & Mobile
Full support
Apple Safari 14.1+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 56+ · Modern versions
Full support

Testing tip

Test horizontal scroll snapping on mobile browsers to confirm inline-start inset clears your side nav width.

scroll-padding-inline property 97% supported

Bottom line: scroll-padding-inline is widely supported in modern browsers for scroll containers and snap layouts.

Conclusion

The scroll-padding-inline property is a useful tool for enhancing the scroll snapping experience on your web pages.

By defining padding in the inline direction on a scroll container, you can create smoother and more visually appealing horizontal scroll behavior. Experiment with different padding values to see how this property can improve the user experience on your site.

💡 Best Practices

✅ Do

  • Prefer logical scroll-padding-inline for RTL and multilingual layouts
  • Apply it to the element that actually scrolls horizontally
  • Pair with scroll-snap-type: x mandatory on carousels
  • Match inline-start inset to fixed side nav width
  • Test horizontal snap panels on mobile browsers

❌ Don’t

  • Confuse scroll-padding-inline with regular padding-inline
  • Apply it to snap targets instead of the scroll container
  • Assume inline-start always means left in every writing mode
  • Forget block-axis inset when content needs top/bottom padding
  • Use huge percentage values without testing small screens

Key Takeaways

Knowledge Unlocked

Five things to remember about scroll-padding-inline

Use these points when insetting inline-axis scroll containers.

5
Core concepts
02

inline axis

Logical flow.

Axis
03

start / end

Two sides.

Values
04

snap

Scroll snapping.

Use case
🔄 05

longhands

inline-start.

Detail

❓ Frequently Asked Questions

scroll-padding-inline sets scrollport inset on the inline axis — inline-start and inline-end — inside a scroll container. In normal horizontal left-to-right writing mode, that usually means left and right.
scroll-padding is the physical shorthand for all four sides. scroll-padding-inline is a logical shorthand that insets only the inline axis, which adapts correctly in vertical writing modes and RTL layouts.
They are logical directions. In horizontal left-to-right writing, inline-start is the left and inline-end is the right. In RTL or vertical writing modes, they map to the corresponding inline flow sides.
The default value is auto, meaning the browser applies no extra inline-axis inset unless you specify a length, percentage, or other value.
Use it on scroll containers when you want inline-axis scrollport insets that work with logical layout, especially with horizontal scroll snapping, carousels, and side navigation.

Practice in the Live Editor

Open the HTML editor and try scroll-padding-inline: 20px on a horizontal scroll container with scroll-snap-type: x mandatory.

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