Thanks to visit codestin.com
Credit goes to www.cssportal.com

CSS Portal

CSS scroll-padding-inline-end Property

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!

Description

The scroll-padding-inline-end property lets you reserve space on the inline‑end side of a scroll container that the browser uses when calculating snapping points and when determining the final position of content brought into view. Rather than adding physical padding that shifts layout, this logical inset tells the scrolling machinery to treat the scroller’s effective viewport as if that inset existed at the inline end, so snapped or scrolled-to elements stop short of the container’s edge by that amount.

This inset directly affects how snap positions are computed for containers that use scroll-snap-type and how items align if they participate in snapping via scroll-snap-align. When a snap is resolved or the browser performs a bring‑into‑view operation, the computed target positions are adjusted inward by the value of the inline‑end scroll padding, which can prevent content from being obscured by overlays or fixed UI positioned at that side.

Because it is a logical property, scroll-padding-inline-end follows writing mode and direction: inline‑end maps to the physical right side in left‑to‑right horizontal writing modes, to the left side in right‑to‑left modes, and to a different physical axis in vertical writing modes. It is most often used alongside the other scroll padding properties (for example, scroll-padding-inline-start or the shorthand scroll-padding) to create consistent insets on multiple sides of a scroll container.

In practice, use scroll-padding-inline-end to ensure the last item in a horizontal carousel doesn’t get pressed up against an overlay or edge, to provide breathing room for keyboard or focus navigation so focused items aren’t hidden, or to align snapped elements predictably when UI components occupy the inline‑end side of the viewport. Remember it alters scrolling and snapping calculations rather than the physical box model of children, so it’s a layout‑friendly way to influence where scrolled content ends up without changing element dimensions.

Definition

Initial value
auto
Applies to
scroll containers
Inherited
no
Computed value
as specified
Animatable
by computed value type
JavaScript syntax
object.style.scrollPaddingInlineEnd

Interactive Demo

1
2
3
Scroll »

Syntax

scroll-padding-inline-end: auto | &tl;length-percentage [0,∞]>

Values

  • autoThe offset is determined by the user agent. This will generally be 0px, but a user agent is able to detect and do something else if a non-zero value is more appropriate.
  • &tl;length-percentage>An inwards offset from the corresponding edge of the scrollport, as a valid length or a percentage.

Example

<main class='example'>
<h2>scroll-padding-inline-end - horizontal scroll snap</h2>
<p class='instruction'>Scroll horizontally. The end of the scroll container reserves extra space for snapping.</p>
<div class='carousel' tabindex='0'>
<div class='card'>Item 1</div>
<div class='card'>Item 2</div>
<div class='card'>Item 3</div>
<div class='card'>Item 4</div>
<div class='card'>Item 5</div>
<div class='card'>Item 6</div>
<div class='card'>Item 7</div>
<div class='card'>Item 8</div>
</div>
</main>
/* Basic page layout */
body {
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial;
  margin: 2rem;
  background: #f7f7fb;
  color: #111827;
}

.example {
  max-width: 800px;
}

.instruction {
  margin: 0 0 1rem 0;
  color: #374151;
  font-size: 0.95rem;
}

/* Scrollable carousel */
.carousel {
  display: flex;
  gap: 1rem;
  padding: 1rem; /* visual padding inside the scroller */
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-inline-end: 3rem; /* <-- reserves 3rem at the inline end for snapping */
  border-radius: 8px;
  background: linear-gradient(180deg,#ffffff,#fbfdff);
  box-shadow: 0 1px 2px rgba(16,24,40,0.04), inset 0 -1px 0 rgba(0,0,0,0.02);
}

.card {
  flex: 0 0 220px;
  height: 140px;
  background: #1f2937;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  border-radius: 8px;
  scroll-snap-align: start; /* each card snaps to the start edge */
  box-shadow: 0 6px 18px rgba(31,41,55,0.08);
}

/* Optional: make keyboard focus visible */
.carousel:focus {
  outline: 3px solid #c7e3ff;
  outline-offset: 4px;
}

Browser Support

The following information will show you the current browser support for the CSS scroll-padding-inline-end property. Hover over a browser icon to see the version that first introduced support for this CSS property.

This property is supported by all modern browsers.
Desktop
Chrome
Edge
Firefox
Opera
Safari
Tablets & Mobile
Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-

Last updated by CSSPortal on: 1st January 2026

If this site has been useful, we’d love your support! Consider buying us a coffee to keep things going strong!