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.
Fundamentals
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.
Foundation
📝 Syntax
The syntax for the scroll-padding-inline property is straightforward. It can accept one or two values.
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.
Defaults
🎯 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.
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.
Preview
👀 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.
Hands-On
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><divclass="scroll-container"><divclass="content">
Scroll sideways to see the inline padding effect.
</div></div>
The carousel leaves extra space at inline-start to clear a fixed side navigation bar.
How It Works
Longhands let you inset only one logical side of the scrollport when the other side does not need adjustment.
Companion
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.
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.
Compatibility
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 Chrome69+ · Desktop & Mobile
Full support
Mozilla Firefox68+ · Desktop & Mobile
Full support
Apple Safari14.1+ · macOS & iOS
Full support
Microsoft Edge79+ · Chromium
Full support
Opera56+ · 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 property97% supported
Bottom line:scroll-padding-inline is widely supported in modern browsers for scroll containers and snap layouts.
Wrap Up
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.
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
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about scroll-padding-inline
Use these points when insetting inline-axis scroll containers.
5
Core concepts
★01
auto Default
No inset.
Default
⚙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.