Created
January 20, 2018 14:29
-
-
Save SiGaCode/ab45dcffc813aeca38230efc41b35999 to your computer and use it in GitHub Desktop.
Set an offset for an onpage anchor, for example if a website has a fixed header and the first part of a paragraph gets hiden. Just add a class of "anchor" to the element in question.
Credits: https://stackoverflow.com/questions/4086107/html-positionfixed-page-header-and-in-page-anchors
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
*.anchor:before { | |
display: block; | |
content: " "; | |
margin-top: -75px; // Set the Appropriate Height | |
height: 75px; // Set the Appropriate Height | |
visibility: hidden; | |
} | |
/* or */ | |
*[id]:before { | |
display: block; | |
content: " "; | |
margin-top: -75px; // Set the Appropriate Height | |
height: 75px; // Set the Appropriate Height | |
visibility: hidden; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment