Skip to content

Instantly share code, notes, and snippets.

@yayMark
Created December 19, 2017 09:15
Show Gist options
  • Select an option

  • Save yayMark/c0804048d429d2d64bc3934405c41fba to your computer and use it in GitHub Desktop.

Select an option

Save yayMark/c0804048d429d2d64bc3934405c41fba to your computer and use it in GitHub Desktop.
Clear a fixed header when linking to a section within the page
<html>
<title></title>
<head>
<style>
/* replace 200px with the height you're attempting to clear */
.jump-target::before {
display: block;
content: " ";
margin-top: -200px;
height: 200px;
visibility: hidden;
pointer-events: none;
}
</style>
</head>
<body>
<a href="#section-name"></a>
<a href="#another-section"></a>
<a href="#sections-a-plenty"></a>
<span class="jump-target" id="section-name"></span>
<span class="jump-target" id="another-section"></span>
<span class="jump-target" id="sections-a-plenty"></span>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment