Skip to content

Instantly share code, notes, and snippets.

@johnnybenson
Created April 26, 2020 21:21
Show Gist options
  • Save johnnybenson/131eaff7f70277e4e790d58e76d15f46 to your computer and use it in GitHub Desktop.
Save johnnybenson/131eaff7f70277e4e790d58e76d15f46 to your computer and use it in GitHub Desktop.
Offset targeted inline anchor
:target {
&::before {
display: block;
content: ' ';
margin-top: -5vh;
height: 5vh;
visibility: hidden;
pointer-events: none;
}
}
@johnnybenson
Copy link
Author

Note: doesn't work for elements that cannot have ::before ::after e.g. <input/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment