CSS Portal

CSS scroll-padding-left 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-left property controls the left inset of a scroll container’s snap area (sometimes called the “snapport”), shifting where content is considered to be aligned when it is scrolled into view or when the browser performs snap scrolling. It does not change the element’s layout, box size, or the element’s own content position - it only modifies the virtual padding that the browser uses when calculating scroll targets and snap destinations. In other words, it creates an invisible offset on the left edge of the scrollport that affects which portion of a child becomes the reference point during programmatic or user-initiated scrolling.

When you use scroll snapping, the visible placement of a snapped child is the result of both the child’s snap alignment and the container’s snapport. If children are given alignment anchors via scroll-snap-align, adjusting the container’s left snap inset with scroll-padding-left moves the spot those children land at without touching their own boxes. Likewise, scroll-padding is the shorthand that groups the four sides; scroll-padding-left is the physical side-specific component of that shorthand and will override the left value when the shorthand is used.

Practically, scroll-padding-left is useful when you have fixed or sticky elements along the left side (for example a persistent navigation rail) or when you want scrolled-to content to avoid being flush with a container edge. Because it only affects the snap/scroll calculations, it’s a lightweight way to ensure visible targets are offset from the left edge without restructuring your layout or adding extra inner wrappers. It’s also helpful for predictable scrollIntoView behavior across different user agents and for arranging where focus lands after keyboard navigation or programmatic focus/scroll operations.

Keep in mind that “left” is a physical direction: in right-to-left or vertical writing contexts you may prefer the logical alternative to get consistent behavior across writing modes. For those cases use the logical property scroll-padding-inline-start so the inset follows the inline-start edge rather than the physical left edge. Finally, remember this property applies to the scroll container itself - it affects how the container interprets snap and scroll targets, not the internal spacing of the child elements themselves.

Definition

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

Interactive Demo

1
2
3
Scroll »

Syntax

scroll-padding-left: auto | <length-percentage [0,∞]>>

Values

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

Example

<nav class="controls">
<a href="#item1">Go to 1</a>
<a href="#item2">Go to 2</a>
<a href="#item3">Go to 3</a>
</nav>

<div class="scroll-container">
<div id="item1" class="item">Item 1</div>
<div id="item2" class="item">Item 2</div>
<div id="item3" class="item">Item 3</div>
<div id="item4" class="item">Item 4</div>
</div>
/* The parent container */
.scroll-container {
  display: flex;
  overflow-x: auto;
  scroll-behavior: smooth;
  border: 2px solid #333;
  width: 500px;
  
  /* This ensures that when you jump to an ID, 
     there is 50px of space on the left */
  scroll-padding-left: 50px;
}

/* Individual items inside the container */
.item {
  flex: 0 0 400px; /* Each item is 400px wide */
  height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  background-color: #f0f0f0;
  border-right: 1px solid #ccc;
}

/* Styling for visibility */
#item1 { background-color: #ffadad; }
#item2 { background-color: #ffd6a5; }
#item3 { background-color: #fdffb6; }
#item4 { background-color: #caffbf; }

.controls {
  margin-bottom: 10px;
}

.controls a {
  padding: 8px 12px;
  background: #007bff;
  color: white;
  text-decoration: none;
  border-radius: 4px;
}

Browser Support

The following information will show you the current browser support for the CSS scroll-padding-left 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!