CSS scroll-padding-right Property

Beginner
⏱️ 5 min read
📚 Updated: Jun 2026
🎯 4 Examples
Scroll Snap

What You’ll Learn

The scroll-padding-right property insets the scrollport at the right edge of a scroll container. It helps ensure content is not too close to the right side when scrolling or scroll snapping.

01

right

Physical edge.

02

inset

Scrollport space.

03

length

px, rem, %.

04

container

On scroll box.

05

carousel

Right inset.

06

snap

Last items.

Introduction

The scroll-padding-right property in CSS is part of the CSS Scroll Snap Module. It allows you to define inset at the right of a scroll container’s scrollport, ensuring that content is not too close to the right edge when it is scrolled into view.

This property is especially useful for horizontal carousels, snap rows, and any scroll container where the last item should not sit flush against the right edge.

Definition and Usage

Apply scroll-padding-right to the scroll container — such as a horizontal carousel with overflow-x: auto and scroll-snap-type: x mandatory.

It is one longhand of the scroll-padding shorthand. Use it when only the right side of the scrollport needs inset.

💡
Beginner Tip

On a normal left-to-right webpage, scroll-padding-right: 50px insets the right side of the scrollport so the last snap item stops before the container edge instead of sitting flush against it.

📝 Syntax

The syntax for the scroll-padding-right property is straightforward. It can be applied to any scroll container.

syntax.css
element {
  scroll-padding-right: length | percentage | auto;
}

Basic Example

right.css
.scroll-container {
  scroll-padding-right: 50px;
}

Related Properties

  • scroll-padding-left, scroll-padding-top, scroll-padding-bottom
  • scroll-padding — shorthand for all four sides
  • scroll-padding-inline-end — logical inline-end inset

🎯 Default Value

The default value of the scroll-padding-right property is auto, which means the user agent determines the padding based on its default settings unless you specify a length or percentage.

⚡ Quick Reference

QuestionAnswer
Default valueauto
Horizontal writing modeRight scrollport inset
Part ofscroll-padding shorthand
Accepted valuesLengths, percentages, auto
Set onScroll containers
InheritedNo
AnimatableNo

💎 Property Values

ValueExampleDescription
lengthscroll-padding-right: 50px;Specifies a fixed amount of inset at the right edge (e.g., 50px, 2em).
percentagescroll-padding-right: 10%;Specifies inset as a percentage of the scroll container’s width.
autoscroll-padding-right: auto;Lets the browser determine the padding automatically.
50px 2rem 10%

When to Use scroll-padding-right

scroll-padding-right helps when the right side of the scrollport needs inset:

  • Last carousel item — Inset the scrollport so the final slide is not clipped at the right edge.
  • Horizontal snap rows — Add space after the last snap stop in a horizontal scroller.
  • Trailing peek spacing — Leave room so the next slide partially shows at the right edge.
  • Overflow panels — Prevent scrolled content from sitting flush against the container’s right edge.

For logical inline-end inset in RTL-aware layouts, consider scroll-padding-inline-end. For the left edge, use scroll-padding-left.

👀 Live Preview

Scroll sideways inside the box. The container uses scroll-padding-right: 2rem.

Wide content inside scrollport
Second panel

The scrollport is inset at the right edge so content stops before the right side.

Examples Gallery

Start with the reference horizontal snap example, inset a snap row at the right, add trailing inset on a carousel, and use the longhand alone on a scroll box.

📜 Right Scrollport Inset

Inset the scrollport at the right edge inside a scroll container — matching the reference example.

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

In this example, we’ll create a horizontal scrollable container with scroll-padding-right set to 50px.

index.html
<style>
  .scroll-container {
    width: 300px;
    height: 200px;
    overflow: auto;
    scroll-snap-type: x mandatory;
    scroll-padding-right: 50px;
    display: flex;
  }

  .scroll-item {
    flex: 0 0 100%;
    height: 100%;
    scroll-snap-align: start;
    margin-right: 10px;
    background-color: lightblue;
  }
</style>

<div class="scroll-container">
  <div class="scroll-item">Item 1</div>
  <div class="scroll-item">Item 2</div>
  <div class="scroll-item">Item 3</div>
</div>
Try It Yourself

How It Works

The scroll container’s snap area is inset from the right edge before the browser settles the position of each item.

Example 2 — Snap scroller right inset

Add scroll-padding-right to a horizontal snap container so the last panel does not hug the right edge.

snap-scroller.css
.snap-box {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-right: 24px;
}
Try It Yourself

How It Works

Container-level right inset applies to every snap stop inside the horizontal scroll box.

📄 Carousels & Layout Insets

Improve right-edge spacing on horizontal carousels and overflow panels.

Example 4 — Right longhand only

When only the right needs inset, use the longhand alone: scroll-padding-right: 3rem;.

longhand-only.css
.scroll-panel {
  scroll-padding-right: 3rem;
}
Try It Yourself

How It Works

Equivalent to scroll-padding: 0 3rem 0 0; when only the right side matters.

scroll-padding-right in the family

scroll-padding-right is the right longhand of scroll-padding. For the opposite side, see scroll-padding-left.

shorthand-equivalent.css
/* These are equivalent when only the right matters */
.a { scroll-padding-right: 2rem; }
.b { scroll-padding: 0 2rem 0 0; }

🧠 How scroll-padding-right Works

1

Scroll container is configured

A scroll box with scroll-padding-right defines right inset for its scrollport.

Container
2

Right edge insets

The browser shrinks the effective snap area away from the container’s right edge.

Inset
3

Content scrolls into place

Snapped or scrolled content lands inside the inset scrollport at the right edge.

Position
=

Comfortable right stops

Trailing content no longer feels cramped against the scrollport’s right edge.

Browser Compatibility

The scroll-padding-right 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.

Physical scroll padding · Modern support

Reliable right-edge support

Current Chrome, Firefox, Safari, Edge, and Opera support scroll-padding-right on scroll containers.

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 right inset clears the last carousel item.

scroll-padding-right property 97% supported

Bottom line: scroll-padding-right is safe to use in modern projects for scroll containers that need right inset.

Conclusion

The scroll-padding-right property is a valuable tool for controlling the snapping area of scrollable containers. It allows precise control over the right padding of the scrollport, ensuring a smooth and visually appealing scrolling experience.

By adjusting the padding at the right of the scrollport, you can ensure content aligns properly when using scroll snapping. Experiment with different values to see how this property can enhance the scrolling behavior of your web projects.

💡 Best Practices

✅ Do

  • Apply scroll-padding-right on the scroll container
  • Use it with horizontal snap scrollers and fixed side navigation
  • Use scroll-padding-inline-end instead when you need RTL-aware logical inset
  • Match inset to carousel peek width or right-side UI
  • Test last-item snap behavior on mobile

❌ Don’t

  • Set it on snap targets instead of the scroll container
  • Confuse it with padding-right layout spacing
  • Assume right always matches inline-end in RTL layouts
  • Use huge percentages without testing on small screens
  • Forget left inset when leading content needs space too

Key Takeaways

Knowledge Unlocked

Five things to remember about scroll-padding-right

Use these points when insetting right scroll containers.

5
Core concepts
02

right

Physical edge.

Axis
03

longhand

One side.

Detail
04

container

Scroll box.

Scope
05

snap

Last items.

Use case
🔄 06

padding

Shorthand family.

Companion

❓ Frequently Asked Questions

scroll-padding-right insets the scrollport at the right edge of a scroll container. It creates space between the container's right edge and where scrolled or snapped content settles.
scroll-padding-right always targets the physical right edge. scroll-padding-inline-end is logical and follows the inline flow, which may map to the left side in RTL layouts.
scroll-padding is a shorthand for all four sides. scroll-padding-right sets only the right inset of the scrollport.
The default value is auto, meaning the browser applies no extra right inset unless you specify a length, percentage, or other value.
Use it on horizontal scroll containers when the last snap item or scrolled content should not sit flush against the right edge, such as for carousels, snap rows, or trailing peek spacing.

Practice in the Live Editor

Open the HTML editor and try scroll-padding-right: 50px on a scroll container.

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