CSS scroll-padding-bottom Property

The CSS scroll-padding-bottom property defines an inset from the bottom edge of a scroll container's scrollport for scroll alignment.

This property helps position scroll targets away from the bottom edge when using scroll snapping, anchor navigation, or programmatic scrolling. It is particularly useful when a fixed footer, bottom toolbar, or other interface element occupies part of the visible scrolling area.

scroll-padding-bottom Syntax

The scroll-padding-bottom property accepts a single non-negative CSS length, percentage, or the auto keyword.

Basic Syntax

selector {
  scroll-padding-bottom: 40px;
}

Available Values

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

CSS-Wide Keywords

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

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

Property Values

Value Description
<length> Sets a non-negative inset using a CSS length such as px, rem, or em.
<percentage> Sets an inset as a percentage of the scrollport's height.
auto Allows the browser to determine an appropriate inset. It generally resolves to zero unless another value is appropriate.
0 Specifies no additional bottom scroll padding.
calc() Calculates a 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 height
Negative values Not accepted
Physical edge Bottom

Valid Values

.container {
  scroll-padding-bottom: 50px;
}
.container {
  scroll-padding-bottom: 15%;
}
.container {
  scroll-padding-bottom: 4rem;
}
.container {
  scroll-padding-bottom: auto;
}
.container {
  scroll-padding-bottom: calc(2rem + 12px);
}

Invalid Values

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

The property accepts only one non-negative length, percentage, or auto value. Negative lengths, multiple values, and unrelated keywords are invalid.

How It Works

The scroll-padding-bottom property establishes an inset from the bottom edge of the scrollport, reducing the optimal viewing region used for scroll alignment.

When a scroll target is aligned toward the bottom of the container, the browser can position it above the inset rather than directly against the scrollport's bottom edge.

Default Bottom Scroll Padding

.container {
  scroll-padding-bottom: auto;
}

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

Fixed Bottom Inset

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

The optimal viewing region ends 60 pixels before the scrollport's bottom edge.

Percentage-Based Inset

.container {
  scroll-padding-bottom: 10%;
}

The inset is calculated as 10% of the scrollport's height.

Relative Lengths

.container {
  scroll-padding-bottom: 3rem;
}

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

No Layout Changes

Scroll padding does not add physical space to the container or move its child elements. Unlike padding-bottom, it affects scroll alignment rather than normal layout.

Available Scroll Range

The browser may not achieve the requested alignment if the container does not have enough available scroll range.

Using scroll-padding-bottom With Scroll Snap

The scroll-padding-bottom property is useful when scroll snap targets should align above the bottom edge of a scrolling container.

Vertical Scroll Snap

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

When an item snaps to the end of the scrollport, the 50-pixel inset allows it to align above the bottom edge.

Different Top and Bottom Insets

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

The optimal viewing region begins 20 pixels below the top edge and ends 60 pixels above the bottom edge.

Combining Scroll Padding and Scroll Margin

.scroll-container {
  scroll-padding-bottom: 40px;
}
.scroll-container .item {
  scroll-margin-bottom: 20px;
}

For end alignment, the two values can produce a combined 60-pixel offset between the item's bottom border edge and the scrollport's bottom edge.

Scroll Snap Alignment

Use scroll-snap-align: end when the target should align with the bottom of the optimal viewing region. The scroll-padding-bottom property does not enable scroll snapping by itself.

Fixed Footers and Bottom Toolbars

A fixed footer or bottom toolbar may cover part of the viewport or a scrolling panel. Scroll padding can help align targets above the covered area.

Fixed Footer Example

.fixed-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 70px;
  background-color: #1e293b;
  color: #ffffff;
}
html {
  scroll-padding-bottom: 70px;
}

When the document is scrolled to align a target near the bottom, the 70-pixel inset can keep the target above the fixed footer.

Adding Extra Spacing

html {
  scroll-padding-bottom: 90px;
}

The additional 20 pixels creates extra separation between aligned targets and a 70-pixel footer.

Using a Custom Property

:root {
  --footer-height: 70px;
}
html {
  scroll-padding-bottom: calc(var(--footer-height) + 16px);
}

A custom property makes it easier to keep the scroll inset synchronized with the footer height.

Responsive Bottom Toolbars

html {
  scroll-padding-bottom: 0;
}
@media (max-width: 767px) {
  html {
    scroll-padding-bottom: 80px;
  }
}

This approach is useful when a bottom navigation toolbar appears only on smaller screens.

Important Consideration

Scroll padding does not physically move content above a fixed footer. If content at the end of the document is permanently obscured, additional layout padding or spacing may also be necessary.

Programmatic Scrolling

JavaScript scrolling methods can use the optimal viewing region established by scroll-padding-bottom when aligning a target.

Using scrollIntoView()

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

The target can align approximately 60 pixels above the bottom edge, provided the scroll container has sufficient scroll range.

Using Nearest Alignment

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

Nearest alignment minimizes scrolling rather than forcing bottom alignment, so the resulting position may 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

Scroll padding influences target alignment. It does not control scrolling speed, animation timing, or keyboard focus.

Using the scroll-padding Shorthand

The scroll-padding shorthand sets the scroll padding insets for the top, right, bottom, and left edges.

One Value

.container {
  scroll-padding: 20px;
}

All four edges receive 20 pixels.

Two Values

.container {
  scroll-padding: 20px 40px;
}

Top and bottom receive 20 pixels. Right and left receive 40 pixels.

Three Values

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

Top receives 10 pixels, right and left receive 20 pixels, and bottom receives 50 pixels.

Four Values

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

The values apply in clockwise order: top, right, bottom, and left.

Overriding Bottom Scroll Padding

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

The bottom inset becomes 60 pixels while the other three edges remain at 20 pixels.

Declaration Order

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

The later shorthand resets the bottom inset to 20 pixels along with the other edges.

Physical Versus Logical Scroll Padding

The scroll-padding-bottom property always refers to the physical bottom edge. Logical properties follow the block or inline axis according to the writing mode.

Physical and Logical Properties

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

Horizontal Writing Mode

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

In horizontal writing, scroll-padding-block-end corresponds to the physical bottom edge.

Vertical Writing Mode

.container {
  writing-mode: vertical-rl;
  scroll-padding-bottom: 50px;
}

The physical bottom inset remains at the bottom, even though the block axis runs horizontally.

Logical Inline-End in Vertical Writing

.container {
  writing-mode: vertical-rl;
  direction: ltr;
  scroll-padding-inline-end: 50px;
}

In this writing mode and direction, inline-end corresponds to the physical bottom edge.

Choosing Between Physical and Logical Properties

Use scroll-padding-bottom when the inset must remain at the bottom regardless of writing mode. Use logical properties when the inset should follow the text flow.

scroll-padding-bottom Versus scroll-margin-bottom

Both properties influence scroll alignment near the bottom edge, but they apply to different elements.

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

Container-Side Scroll Padding

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

The container provides a consistent bottom alignment inset for its scroll targets.

Target-Side Scroll Margin

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

The featured target receives an additional bottom alignment area.

Combining Both Properties

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

For bottom alignment, the values can produce a combined 60-pixel offset between the target's bottom border edge and the scrollport's bottom 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-bottom Example

This interactive example compares two scrolling panels. The second panel uses scroll-padding-bottom: 50px to align the target farther from the bottom edge.

HTML Example

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

JavaScript Example

document.querySelectorAll(".scroll-bottom-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 Bottom Scroll Padding

Item 1
Item 2
Target
Item 4
Item 5
Item 6

Click each button to scroll the target into view. In the second panel, the 50-pixel bottom inset moves the target's requested end alignment higher within the scrollport.

Increasing Bottom Scroll Padding

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

The bottom alignment inset increases to 80 pixels.

Removing Bottom Scroll Padding

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

The additional bottom alignment inset is removed.

Browser Compatibility Note

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

Accessibility Considerations

Bottom scroll padding can help keep content visible when fixed footers or bottom toolbars overlap a scrolling area.

Avoid Obscured Content

Use an appropriate bottom inset when interface elements could cover targets during scrolling.

Maintain Keyboard Accessibility

Ensure scrolling controls are keyboard accessible and have visible focus indicators.

Consider Focus Management

Programmatic scrolling does not automatically move keyboard focus. 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.

Test Responsive Interfaces

Check scroll alignment at different viewport sizes, browser zoom levels, and text scaling settings, especially when mobile bottom toolbars are present.

Common Mistakes

Using Negative Values

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

Negative values are invalid.

Providing Multiple Values

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

This longhand property accepts only one value.

Confusing Scroll Padding With Layout Padding

scroll-padding-bottom affects scroll alignment, while padding-bottom adds normal layout spacing.

Applying Scroll Padding to the Target

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

Expecting Automatic Scroll Snapping

The property does not enable scroll snapping by itself.

Ignoring Declaration Order

A later scroll-padding shorthand can override an earlier scroll-padding-bottom 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.

Expecting Scroll Padding to Create Extra Content Space

Scroll padding does not extend the scrollable content area. Additional layout spacing may be required when fixed interface elements obscure content at the end of a page.

Important Considerations

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

  • It defines a scroll alignment inset at the physical bottom edge.
  • It is a longhand of scroll-padding.
  • 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 height.
  • It always applies to the physical bottom edge, regardless of writing mode.
  • It does not change normal layout spacing or element dimensions.
  • It can influence scroll snapping, anchor navigation, and programmatic scrolling.
  • It is useful when fixed footers or bottom toolbars occupy part of the scrolling area.
  • It does not create a scroll container or enable scroll snapping.
  • Use scroll-padding-top for the opposite physical edge.
  • Use scroll-padding-block-end when the inset should follow the logical block-end edge.
  • Use scroll-margin-bottom when individual targets need a bottom alignment offset.
  • Available scroll range may limit the final alignment position.
  • Test scrolling behavior across viewport sizes, writing modes, and input methods.

Browser Support

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

Support in older browsers may be limited, particularly in earlier implementations of CSS Scroll Snap.

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

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

Specifications

The scroll-padding-bottom 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-bottom