Skip to content

Add scroll-margin-top on all :target elements - #1174

Merged
st0012 merged 2 commits into
ruby:masterfrom
omegahm:scroll-margin
Oct 17, 2024
Merged

st0012 merged 2 commits into
ruby:masterfrom
omegahm:scroll-margin

Conversation

@omegahm

@omegahm omegahm commented Sep 6, 2024

Copy link
Copy Markdown
Contributor

This sets scroll-margin-top on all h1 through h6 when applied with the element state target. This happens when you click a link and are taking to that anchor (with #).

scroll-margin-top adds a margin of 1rem where it jumps to, adding a bit of space at the top of the page.

Before After
Screenshot 2024-09-06 at 21 44 07 Screenshot 2024-09-06 at 21 43 51

@st0012 st0012 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is great, thank you!

@st0012 st0012 added this to the v6.8.0 milestone Oct 17, 2024
@st0012
st0012 merged commit 7398e5b into ruby:master Oct 17, 2024
matzbot pushed a commit to ruby/ruby that referenced this pull request Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants