Last active
February 3, 2018 14:06
-
-
Save eSaner/f8833068c85e8d952ad0f3e6c990cb57 to your computer and use it in GitHub Desktop.
Anchor links under fixed header
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
/** | |
* Pure css solution inspired by Alexander Savin: | |
* @see https://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header/24298427#24298427 | |
*/ | |
a[name] { | |
padding-top: 40px; | |
margin-top: -40px; | |
display: inline-block; /* required for webkit browsers */ | |
} | |
// Optionally you may want to add the following if the target is still off the screen: | |
// vertical-align: top; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment