Skip to content

Instantly share code, notes, and snippets.

@ellegaarddk
Last active July 27, 2022 07:41
Show Gist options
  • Save ellegaarddk/2a61005d2354fd806b7d920fb539e645 to your computer and use it in GitHub Desktop.
Save ellegaarddk/2a61005d2354fd806b7d920fb539e645 to your computer and use it in GitHub Desktop.
Keeping anchor point below sticky header
/** better solution
* description on https://wp-pro.dk/?p=3656
**/
:target { scroll-margin-top:75px}
/** old solution - don't use this! **/
body:not(.elementor-editor-active) /* for not messsing up elementor editor */
*[id]:before {
content: "";
display:block;
height: 150px; /* fixed header height*/
margin: -150px 0 0; /* negative fixed header height */
visibility: hidden;
pointer-events: none;
z-index: -1; /* This prevents any links being behind the offset block and un-clickable */
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment