Last active
September 3, 2015 18:54
-
-
Save jonnymaceachern/1a78d9e895066b7dcd97 to your computer and use it in GitHub Desktop.
Adds an offset when jumping to a pages anchor/id to account for a fixed header that may overlap the content.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* When using a fixer header that takes up the top 100px | |
or so, you can offset the anchor jump using the following */ | |
.offset-anchor:before { | |
display: block; | |
content: " "; | |
height: 100px; /* Give height of your fixed element */ | |
margin-top: -100px; /* Give negative margin of your fixed element */ | |
visibility: hidden; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment