Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,25 @@ While defined in the [CSS scroll snap](/en-US/docs/Web/CSS/Guides/Scroll_snap) m

{{csssyntax}}

## Examples
Comment thread
estelle marked this conversation as resolved.

### Preventing content from being hidden by a fixed header

A common use case for `scroll-padding` is to prevent scrolling content from being hidden by a fixed-position header. This example demonstrates how to use `scroll-padding` for this purpose.

```css

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As it stands, this doesn't really demonstrate the use case very clearly. Can you expand the example to show more complete code and a live example perhaps? It doesn't have to be as elaborate as this example, but this is the kind of pattern you should ideally follow: https://developer.mozilla.org/en-US/docs/Web/CSS/Reference/Properties/scroll-target-group#basic_scroll-target-group_usage.

header {
position: fixed;
top: 0;
height: 60px;
width: 100%;
}

html {
scroll-padding-top: 60px;
}
```

## Specifications

{{Specifications}}
Expand Down
Loading