CSS scroll-padding-block-end Property

The CSS scroll-padding-block-end property defines a scroll alignment inset at the logical block-end edge of a scroll container.

The physical edge depends on the container's writing mode. In horizontal writing, block-end is the bottom edge. In vertical writing, it can be the left or right edge. This property helps keep scroll targets within an optimal viewing region without changing normal layout spacing.

scroll-padding-block-end Syntax

The scroll-padding-block-end property accepts one non-negative CSS length, a percentage, or the auto keyword.

Basic Syntax

selector {
  scroll-padding-block-end: 20px;
}

Available Values

.container {
  scroll-padding-block-end: 0;
}
.container {
  scroll-padding-block-end: 20px;
}
.container {
  scroll-padding-block-end: 2rem;
}
.container {
  scroll-padding-block-end: 1.5em;
}
.container {
  scroll-padding-block-end: 10%;
}
.container {
  scroll-padding-block-end: auto;
}
.container {
  scroll-padding-block-end: calc(2rem + 10px);
}

CSS-Wide Keywords

.container {
  scroll-padding-block-end: initial;
}
.container {
  scroll-padding-block-end: inherit;
}
.container {
  scroll-padding-block-end: unset;
}
.container {
  scroll-padding-block-end: revert;
}
.container {
  scroll-padding-block-end: revert-layer;
}

Negative values are invalid. Unlike scroll-margin-block-end, this property accepts percentages and auto.

Property Values

Value Description
<length> Sets the block-end scroll padding using a non-negative CSS length such as px, rem, or em.
<percentage> Sets the inset as a percentage of the scrollport's dimension along the block axis.
auto Lets the browser determine an appropriate inset. It generally resolves to zero unless another value is appropriate.
0 Applies no additional block-end scroll padding.
calc() Calculates a valid non-negative length or percentage-based value.
initial Resets the property to its initial value of auto.
inherit Uses the computed value from the parent element.
unset Resets the property to auto because it is not inherited.
revert Reverts the property according to CSS cascade origin rules.
revert-layer Reverts the property according to CSS cascade layer rules.

Property Characteristics

Characteristic Value
Initial value auto
Inherited No
Applies to Scroll containers
Computed value As specified
Animation type By computed value type
Percentages Relative to the scrollport's block-axis dimension
Negative values Not accepted
Logical edge Block-end

Valid Values

.container {
  scroll-padding-block-end: 40px;
}
.container {
  scroll-padding-block-end: 10%;
}
.container {
  scroll-padding-block-end: 4rem;
}
.container {
  scroll-padding-block-end: auto;
}
.container {
  scroll-padding-block-end: calc(3rem + 10px);
}

Invalid Values

.container {
  scroll-padding-block-end: -10px;
}
.container {
  scroll-padding-block-end: 10px 20px;
}
.container {
  scroll-padding-block-end: smooth;
}
.container {
  scroll-padding-block-end: 2s;
}
.container {
  scroll-padding-block-end: normal;
}

This longhand property accepts one non-negative length, percentage, or auto value. Multiple values, negative lengths, and scrolling behavior keywords are invalid.

How It Works

The scroll-padding-block-end property establishes an inset from the block-end edge of the scrollport.

This inset reduces the optimal viewing region used for scroll alignment, helping targets align away from the block-end edge.

Default Block-End Scroll Padding

.container {
  scroll-padding-block-end: auto;
}

The browser determines the inset. In most cases, the effective value is zero.

Fixed Block-End Inset

.container {
  scroll-padding-block-end: 40px;
}

The optimal viewing region ends 40 pixels before the scrollport's block-end edge.

Percentage-Based Inset

.container {
  scroll-padding-block-end: 10%;
}

In horizontal writing, the percentage is based on the scrollport's height. In vertical writing, it is based on the scrollport's width.

Relative Lengths

.container {
  scroll-padding-block-end: 3rem;
}

Relative units allow the inset to scale with font-size settings.

No Layout Changes

Unlike padding-block-end, scroll padding does not add layout space, move child elements, or change the container's box dimensions.

Scroll Range Limitations

The browser may not achieve the requested alignment when the container does not have sufficient available scroll range.

Writing Modes and Logical Edges

The physical edge controlled by scroll-padding-block-end depends on the writing mode of the scroll container.

Logical Edge Mapping

Writing Mode Block-End Edge
horizontal-tb Bottom
vertical-rl Left
vertical-lr Right
sideways-rl Left
sideways-lr Right

Horizontal Writing Mode

.container {
  writing-mode: horizontal-tb;
  scroll-padding-block-end: 40px;
}

The 40-pixel inset applies to the physical bottom edge.

Vertical Right-to-Left Writing Mode

.container {
  writing-mode: vertical-rl;
  scroll-padding-block-end: 40px;
}

The 40-pixel inset applies to the physical left edge.

Vertical Left-to-Right Writing Mode

.container {
  writing-mode: vertical-lr;
  scroll-padding-block-end: 40px;
}

The 40-pixel inset applies to the physical right edge.

Text Direction

Changing direction between ltr and rtl affects the inline axis, but it does not reverse block-start and block-end in these writing modes.

Choosing Logical Properties

Logical properties are useful when a layout must adapt to horizontal and vertical writing systems without rewriting physical edge declarations.

Using scroll-padding-block-end With Scroll Snap

The scroll-padding-block-end property is useful when scroll snap targets should align before reaching the block-end edge of a scroll container.

Vertical Scroll Snap

.scroll-container {
  height: 300px;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  scroll-padding-block-end: 40px;
}
.scroll-container .item {
  min-height: 200px;
  scroll-snap-align: end;
}

In horizontal writing, items using scroll-snap-align: end can align 40 pixels above the scrollport's bottom edge.

Different Start and End Insets

.scroll-container {
  scroll-padding-block-start: 20px;
  scroll-padding-block-end: 60px;
}

The optimal viewing region has a 20-pixel block-start inset and a 60-pixel block-end inset.

Vertical Writing Mode

.scroll-container {
  writing-mode: vertical-rl;
  width: 300px;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scroll-padding-block-end: 40px;
}
.scroll-container .item {
  scroll-snap-align: end;
}

In vertical-rl, the block-end edge is physically on the left. The scroll padding creates a 40-pixel inset from that edge.

Combining With Scroll Margin

.scroll-container {
  scroll-padding-block-end: 30px;
}
.scroll-container .item {
  scroll-margin-block-end: 20px;
}

For block-end alignment, the two values can provide a combined 50-pixel offset between the item's block-end border edge and the scrollport's block-end edge.

Important Consideration

Scroll padding does not activate scroll snapping. The container requires scroll-snap-type, and the targets require scroll-snap-align.

Programmatic Scrolling

JavaScript scrolling methods can use the optimal viewing region defined by scroll-padding-block-end when aligning a target.

Using scrollIntoView()

.scroll-container {
  scroll-padding-block-end: 60px;
}
document.querySelector(".target").scrollIntoView({
  behavior: "smooth",
  block: "end"
});

In horizontal writing, end alignment can position the target approximately 60 pixels above the scrollport's bottom edge, provided sufficient scroll range is available.

Using Nearest Alignment

document.querySelector(".target").scrollIntoView({
  behavior: "smooth",
  block: "nearest"
});

Nearest alignment minimizes scrolling rather than forcing block-end alignment. The visible effect of the inset can therefore differ.

Respecting Reduced Motion

const reduceMotion = window.matchMedia("(prefers-reduced-motion: reduce)").matches;
document.querySelector(".target").scrollIntoView({
  behavior: reduceMotion ? "instant" : "smooth",
  block: "end"
});

Consider reduced-motion preferences when using animated scrolling.

Important Consideration

The scroll-padding-block-end property controls alignment spacing, not scroll animation or scrolling speed.

Using the scroll-padding-block Shorthand

The scroll-padding-block shorthand sets both block-start and block-end scroll padding.

One-Value Shorthand

.container {
  scroll-padding-block: 30px;
}

Both block-start and block-end receive 30 pixels.

Two-Value Shorthand

.container {
  scroll-padding-block: 20px 60px;
}

Block-start receives 20 pixels, and block-end receives 60 pixels.

Equivalent Longhand Declarations

.container {
  scroll-padding-block-start: 20px;
  scroll-padding-block-end: 60px;
}

Overriding Block-End

.container {
  scroll-padding-block: 20px;
  scroll-padding-block-end: 60px;
}

The block-end inset becomes 60 pixels, while block-start remains 20 pixels.

Declaration Order

.container {
  scroll-padding-block-end: 60px;
  scroll-padding-block: 20px;
}

The later shorthand resets both block-axis insets to 20 pixels.

Combining Block and Inline Insets

.container {
  scroll-padding-block: 20px 60px;
  scroll-padding-inline: 30px;
}

The block axis uses different start and end insets, while both inline edges receive 30 pixels.

Logical Versus Physical Scroll Padding

The scroll-padding-block-end property follows the logical block-end edge. Physical scroll padding properties always refer to fixed physical edges.

Property Edge
scroll-padding-block-end Logical block-end
scroll-padding-block-start Logical block-start
scroll-padding-inline-end Logical inline-end
scroll-padding-bottom Physical bottom
scroll-padding-left Physical left
scroll-padding-right Physical right

Physical Bottom Scroll Padding

.container {
  scroll-padding-bottom: 60px;
}

The inset always applies to the physical bottom edge.

Logical Block-End Scroll Padding

.container {
  scroll-padding-block-end: 60px;
}

The inset follows the block-end edge, which depends on writing mode.

Overlapping Declarations

.container {
  writing-mode: horizontal-tb;
  scroll-padding-bottom: 20px;
  scroll-padding-block-end: 60px;
}

Both declarations affect the bottom edge in horizontal writing mode. With equal specificity and importance, the later declaration takes precedence.

Choosing Between Logical and Physical Properties

Use logical properties when the inset should follow writing mode. Use physical properties when the inset must remain on a specific screen edge.

scroll-padding-block-end Versus scroll-margin-block-end

Both properties influence alignment at the logical block-end edge, but they are applied to different elements.

Property Applied To Purpose
scroll-padding-block-end Scroll container Defines an inset from the block-end edge of the optimal viewing region.
scroll-margin-block-end Scroll target Expands or contracts the target's scroll alignment area at its block-end edge.

Container-Side Scroll Padding

.scroll-container {
  scroll-padding-block-end: 40px;
}

The container provides a consistent block-end alignment inset for its scroll targets.

Target-Side Scroll Margin

.scroll-container .featured {
  scroll-margin-block-end: 20px;
}

The featured target receives an additional block-end alignment area.

Combining Both Properties

.scroll-container {
  scroll-padding-block-end: 40px;
}
.scroll-container .featured {
  scroll-margin-block-end: 20px;
}

For block-end alignment, these values can create a combined 60-pixel offset between the target's block-end border edge and the scrollport's block-end edge.

Important Difference

Scroll padding accepts percentages and auto but not negative values. Scroll margin accepts negative lengths but not percentages or auto.

scroll-padding-block-end Example

This interactive example compares two vertically scrolling panels. The second panel applies a 50-pixel block-end inset, which corresponds to the bottom edge in horizontal writing mode.

HTML Example

<div class="scroll-block-end-demo">
  <div class="scroll-example">
    <h3>Without Scroll Padding</h3>
    <div class="scroll-panel">
      <div class="item">Item 1</div>
      <div class="item">Item 2</div>
      <div class="item target">Target</div>
      <div class="item">Item 4</div>
      <div class="item">Item 5</div>
      <div class="item">Item 6</div>
    </div>
    <button type="button">Scroll to Target</button>
  </div>
  <div class="scroll-example with-padding">
    <h3>With Block-End Scroll Padding</h3>
    <div class="scroll-panel">
      <div class="item">Item 1</div>
      <div class="item">Item 2</div>
      <div class="item target">Target</div>
      <div class="item">Item 4</div>
      <div class="item">Item 5</div>
      <div class="item">Item 6</div>
    </div>
    <button type="button">Scroll to Target</button>
  </div>
</div>

CSS Example

.scroll-block-end-demo {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 220px), 1fr));
  gap: 20px;
}
.scroll-block-end-demo .scroll-panel {
  height: 180px;
  overflow-y: auto;
  padding: 10px;
  border: 1px solid #cbd5e1;
  background-color: #f8fafc;
  scroll-snap-type: y mandatory;
}
.scroll-block-end-demo .item {
  padding: 22px 10px;
  margin-bottom: 10px;
  text-align: center;
  background-color: #e2e8f0;
  scroll-snap-align: end;
}
.scroll-block-end-demo .target {
  background-color: #bfdbfe;
  border: 2px solid #2563eb;
}
.scroll-block-end-demo .with-padding .scroll-panel {
  scroll-padding-block-end: 50px;
}
.scroll-block-end-demo button {
  margin-top: 10px;
  padding: 8px 12px;
  cursor: pointer;
}

JavaScript Example

document.querySelectorAll(".scroll-block-end-demo .scroll-example").forEach((example) => {
  const button = example.querySelector("button");
  const target = example.querySelector(".target");
  button.addEventListener("click", () => {
    target.scrollIntoView({
      behavior: window.matchMedia("(prefers-reduced-motion: reduce)").matches ? "instant" : "smooth",
      block: "end",
      inline: "nearest"
    });
  });
});
Browser Result

Without Scroll Padding

Item 1
Item 2
Target
Item 4
Item 5
Item 6

With Block-End Scroll Padding

Item 1
Item 2
Target
Item 4
Item 5
Item 6

Click each button to bring the target toward the bottom of its panel. The second panel requests a 50-pixel inset from the bottom edge, so the target can align higher within the scrollport.

Increasing the Block-End Inset

.scroll-block-end-demo .with-padding .scroll-panel {
  scroll-padding-block-end: 80px;
}

The block-end alignment inset increases to 80 pixels.

Removing the Block-End Inset

.scroll-block-end-demo .with-padding .scroll-panel {
  scroll-padding-block-end: 0;
}

The additional block-end alignment inset is removed.

Browser Compatibility Note

The final scroll position depends on available scroll range and scroll snapping behavior. Targets near the beginning or end of the container may not reach the requested alignment.

Accessibility Considerations

Block-end scroll padding can improve the visibility of content when a scrolling interface includes fixed controls or other elements near the block-end edge.

Keep Scroll Targets Visible

Use an appropriate inset when interface elements near the block-end edge could obscure content during scrolling.

Maintain Keyboard Accessibility

Scrolling controls should remain keyboard accessible and display visible focus indicators.

Consider Focus Management

Programmatic scrolling does not automatically move keyboard focus to the target. Scripted navigation may require additional focus handling.

Respect Reduced Motion Preferences

The property does not animate scrolling. If smooth scrolling is used, respect prefers-reduced-motion.

Support Different Writing Modes

Logical scroll padding adapts to writing mode, helping maintain consistent alignment in horizontal and vertical text layouts.

Test Responsive Layouts

Verify that targets remain visible at different viewport sizes, browser zoom levels, and text scaling settings.

Common Mistakes

Using Negative Values

.container {
  scroll-padding-block-end: -20px;
}

Negative values are invalid.

Providing Multiple Values

.container {
  scroll-padding-block-end: 10px 20px;
}

This longhand property accepts only one value.

Confusing Block-End With Bottom

Block-end corresponds to the bottom edge in horizontal writing but can correspond to the left or right edge in vertical writing.

Confusing Scroll Padding With Layout Padding

scroll-padding-block-end affects scroll alignment, while padding-block-end affects normal layout spacing.

Applying the Property to a Scroll Target

Apply scroll-padding-block-end to the scroll container. Use scroll-margin-block-end on individual targets.

Expecting Automatic Scroll Snapping

The property does not enable scroll snapping by itself.

Ignoring Declaration Order

A later scroll-padding-block shorthand can override an earlier scroll-padding-block-end declaration.

Ignoring Physical and Logical Conflicts

Physical and logical scroll padding declarations may affect the same edge. The CSS cascade determines which declaration applies.

Ignoring Available Scroll Range

The browser may not achieve the requested alignment when the container cannot scroll far enough.

Important Considerations

Keep the following points in mind when using scroll-padding-block-end:

  • It defines a scroll alignment inset at the logical block-end edge.
  • It is a longhand of scroll-padding-block.
  • Its initial value is auto, and it is not inherited.
  • It accepts one non-negative length, percentage, or auto value.
  • Negative values are invalid.
  • Percentages are relative to the scrollport's block-axis dimension.
  • Its physical edge depends on the writing mode.
  • In horizontal writing, block-end corresponds to the bottom edge.
  • In vertical-rl, block-end corresponds to the left edge.
  • In vertical-lr, block-end corresponds to the right edge.
  • It does not change normal layout spacing or element dimensions.
  • It can influence scroll snapping and programmatic scrolling.
  • It does not create a scroll container or enable scroll snapping.
  • Use scroll-padding-block-start for the opposite logical block edge.
  • Use scroll-margin-block-end when individual targets need a block-end alignment offset.
  • Available scroll range may limit the final alignment position.
  • Test scrolling behavior across writing modes, viewport sizes, and input methods.

Browser Support

The CSS scroll-padding-block-end property is supported in current versions of major browsers, including Chrome, Edge, Firefox, and Safari.

Support in older browsers may be limited, particularly for logical scroll padding properties and vertical writing modes.

For current compatibility information, visit Can I Use? and search for scroll-padding-block-end.

When unsupported, scrolling generally remains functional, but the requested logical alignment inset may not be applied.

Specifications

The scroll-padding-block-end property is defined in CSS Scroll Snap Module Level 1.

CSS Scroll Snap Module Level 1

The specification defines how scroll padding establishes the optimal viewing region within a scrollport.

For additional documentation and examples, consult MDN Web Docs.

MDN Web Docs: scroll-padding-block-end