docs(css): add scroll-padding example for fixed header#42548
docs(css): add scroll-padding example for fixed header#42548lucifer13598 wants to merge 7 commits into
Conversation
|
Preview URLs Flaws (11)URL:
(comment last updated: 2026-01-04 17:41:51) |
chrisdavidmills
left a comment
There was a problem hiding this comment.
Hi there @lucifer13598, and thank you for your contribution to MDN.
I had a few comments for you; let me know what you think of them.
| A common use case for `scroll-padding` is when a page includes a fixed-position header. | ||
| Without `scroll-padding`, content linked via fragment identifiers can be hidden beneath the header. | ||
|
|
||
| ```css |
There was a problem hiding this comment.
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.
Co-authored-by: Chris Mills <chrisdavidmills@gmail.com>
Co-authored-by: Chris Mills <chrisdavidmills@gmail.com>
Description
Added a new example to the
scroll-paddingdocumentation demonstrating how it prevents content from being hidden behind a fixed-position header.Motivation
The existing documentation explained the concept but did not include a practical example. This change helps readers clearly understand a common real-world use case when using fragment links with fixed headers.
Additional details
No additional references required.
Related issues and pull requests
Fixes #42183