CSS scroll-padding-block Property

Beginner
⏱️ 6 min read
📚 Updated: Jun 2026
🎯 4 Examples
Logical Properties

What You’ll Learn

The scroll-padding-block property insets the scrollport on the block axis inside a scroll container. It is the logical companion to physical top/bottom scroll padding and works well with scroll snapping.

01

block

Vertical flow axis.

02

start

Block-start side.

03

end

Block-end side.

04

snap

Scroll snapping.

05

length

px, rem, %.

06

logical

Writing-mode safe.

Introduction

The scroll-padding-block property in CSS is a shorthand property that sets the scroll padding of a scroll container in the block dimension.

This property defines the space between the snap position and the edges of the scroll container on the block axis (top and bottom 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 scroll snapping experience.

Definition and Usage

scroll-padding-block is a logical shorthand for scroll-padding-block-start and scroll-padding-block-end. Apply it to the scroll container — such as html or an element with overflow: auto and scroll-snap-type.

In standard horizontal writing mode, block-start maps to the top and block-end maps to the bottom. That makes scroll-padding-block: 4rem 1rem similar to setting top and bottom scrollport insets, but it stays correct if the writing mode changes.

💡
Beginner Tip

On a normal English webpage, think of scroll-padding-block as “top and bottom scrollport inset” that follows the document’s block direction.

📝 Syntax

The syntax for the scroll-padding-block property is straightforward. It can accept one or two values.

syntax.css
element {
  scroll-padding-block: length | percentage | auto;
}
  • If one value is specified, it applies the same inset to both block-start and block-end.
  • If two values are specified, the first applies to block-start and the second to block-end.

Basic Example

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

Longhand Properties

  • scroll-padding-block-start — inset at the block-start edge
  • scroll-padding-block-end — inset at the block-end edge

Syntax Rules

  • One value sets both block-start and block-end equally.
  • Two values set block-start first, then block-end.
  • Percentages are relative to the scroll container’s block size.
  • Set the inset on the scroll container, not on individual snap targets.

🎯 Default Value

The default value for the scroll-padding-block property is auto, which means no extra block-axis inset is applied unless you specify a length or percentage.

⚡ Quick Reference

QuestionAnswer
Default valueauto
Horizontal writing modeUsually top and bottom scrollport inset
Shorthand forscroll-padding-block-start + scroll-padding-block-end
Accepted valuesLengths, percentages, auto
Set onScroll containers
InheritedNo
AnimatableNo

💎 Property Values

ValueExampleDescription
lengthscroll-padding-block: 20px;Defines a fixed inset using units like px, em, rem, etc.
percentagescroll-padding-block: 10%;Defines inset as a percentage of the scroll container’s block size.
autoscroll-padding-block: auto;Lets the browser calculate the padding.
20px 4rem 1rem 10%

When to Use scroll-padding-block

scroll-padding-block is the right choice when block-axis scrollport insets should follow logical layout:

  • Scroll snapping — Inset snapped panels from container block edges.
  • Fixed headers — Inset block-start so content is not hidden under fixed UI.
  • International layouts — Prefer logical properties over hard-coded top/bottom rules.
  • Nested scroll areas — Fine-tune vertical snap stops inside overflow boxes.

For inline-axis insets, use scroll-padding-inline instead.

👀 Live Preview

Scroll inside the panel. The container uses scroll-snap-type: y mandatory and scroll-padding-block: 12px.

Section 1
Section 2
Section 3

The block-axis inset creates breathing room when each panel snaps inside the scrollport.

Examples Gallery

Start with the reference scroll-snap example, set different block-start and block-end values, try a scroll container, and use scroll-padding-block-start with a sticky header.

📜 Block-Axis Scrollport Inset

Inset the scrollport on the block axis inside a scroll container — matching the reference example.

Example 1 — scroll-padding-block with scroll snap

In this example, we’ll apply scroll padding to a container so items snap with padding from the top and bottom edges.

index.html
<style>
  .scroll-container {
    width: 300px;
    height: 200px;
    overflow: auto;
    scroll-snap-type: y mandatory;
    scroll-padding-block: 20px;
  }

  .scroll-item {
    height: 150px;
    scroll-snap-align: start;
  }
</style>

<div class="scroll-container">
  <div class="scroll-item">Item 1</div>
  <div class="scroll-item">Item 2</div>
</div>
Try It Yourself

How It Works

scroll-padding-block insets the scrollport on the block axis before the browser settles each snap position.

Example 2 — Different block-start and block-end values

Use two values when block-start and block-end insets should differ: scroll-padding-block: 4rem 1.5rem;.

start-end.css
html {
  scroll-padding-block: 4rem 1.5rem;
}
Try It Yourself

How It Works

The first value applies to block-start; the second applies to block-end.

🗃 Scroll Containers

Use block-axis insets inside overflow panels and full-page scroll layouts.

Example 3 — Block inset inside a scroll box

Combine scroll-snap-type and scroll-padding-block on the same scroll container.

container-snap.css
.snap-box {
  overflow: auto;
  scroll-snap-type: y mandatory;
  scroll-padding-block: 16px;
}

.panel {
  scroll-snap-align: start;
}
Try It Yourself

How It Works

The container defines both snapping and the block-axis scrollport inset for all child panels.

Example 4 — scroll-padding-block-start

When only the block-start side needs inset, use the longhand: scroll-padding-block-start: 3.5rem;.

block-start.css
html {
  scroll-padding-block-start: 3.5rem;
}
Try It Yourself

How It Works

Longhands let you inset only one logical side of the scrollport when the other side does not need adjustment.

scroll-padding-block vs scroll-padding

scroll-padding is the physical shorthand for all four sides. scroll-padding-block targets only the block axis and is safer for multilingual layouts.

Pair with scroll-behavior: smooth for animated anchor navigation and with scroll-snap-align for snapped carousels or section scrollers.

logical-vs-physical.css
/* Physical shorthand */
.physical { scroll-padding-top: 4rem; }

/* Logical equivalent in horizontal writing */
.logical { scroll-padding-block-start: 4rem; }

🧠 How scroll-padding-block Works

1

Block axis is determined

Writing mode decides which container edges are block-start and block-end.

Logical
2

Scrollport edges inset

scroll-padding-block shrinks the effective snap area on both block edges of the container.

Inset
3

Content snaps into place

Snapped items land inside the inset scrollport instead of flush against block edges.

Position
=

Comfortable block-axis snaps

Snapped content stays visible, even with fixed headers on the block-start side.

Browser Compatibility

The scroll-padding-block 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-block support

Current Chrome, Firefox, Safari, Edge, and Opera support logical scroll-padding properties.

97% Modern browser support
Google Chrome 69+ · Desktop & Mobile
Full support
Mozilla Firefox 68+ · Desktop & Mobile
Full support
Apple Safari 14.1+ · macOS & iOS
Full support
Microsoft Edge 79+ · Chromium
Full support
Opera 56+ · Modern versions
Full support

Testing tip

Test scroll snapping on iOS Safari to confirm block-start inset clears your fixed header height.

scroll-padding-block property 97% supported

Bottom line: scroll-padding-block is widely supported in modern browsers for scroll containers and snap layouts.

Conclusion

The scroll-padding-block property is a useful tool for enhancing the scroll snapping experience on your web pages.

By defining padding in the block direction on a scroll container, you can create smoother and more visually appealing scroll behavior. Experiment with different padding values to see how this property can improve the user experience on your site.

💡 Best Practices

✅ Do

  • Prefer logical scroll-padding-block for international layouts
  • Apply it to the element that actually scrolls
  • Pair with scroll-snap-type on the same container
  • Match block-start inset to fixed header height
  • Test vertical snap panels on mobile browsers

❌ Don’t

  • Confuse scroll-padding-block with regular padding-block
  • Apply it to snap targets instead of the scroll container
  • Assume block-start always means top in every writing mode
  • Forget inline-axis inset when content needs side padding
  • Use huge percentage values without testing small screens

Key Takeaways

Knowledge Unlocked

Five things to remember about scroll-padding-block

Use these points when insetting block-axis scroll containers.

5
Core concepts
02

block axis

Logical flow.

Axis
03

start / end

Two sides.

Values
04

snap

Scroll snapping.

Use case
🔄 05

longhands

block-start.

Detail

❓ Frequently Asked Questions

scroll-padding-block sets scrollport inset on the block axis — block-start and block-end — inside a scroll container. In normal horizontal writing mode, that usually means top and bottom.
scroll-padding is the physical shorthand for all four sides. scroll-padding-block is a logical shorthand that insets only the block axis, which adapts correctly in vertical writing modes.
They are logical directions. In horizontal left-to-right writing, block-start is the top and block-end is the bottom. In vertical writing modes, they map to the corresponding block flow sides.
The default value is auto, meaning the browser applies no extra block-axis inset unless you specify a length, percentage, or other value.
Use it on scroll containers when you want block-axis scrollport insets that work with logical layout, especially with scroll snapping and vertically flowing content.

Practice in the Live Editor

Open the HTML editor and try scroll-padding-block: 20px on a scroll container with scroll-snap-type.

HTML Editor →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

5 people found this page helpful