Skip to content

Instantly share code, notes, and snippets.

@seth10
Created October 20, 2017 20:20
Show Gist options
  • Save seth10/0c0ec89e10f6b72546855ce9c205957a to your computer and use it in GitHub Desktop.
Save seth10/0c0ec89e10f6b72546855ce9c205957a to your computer and use it in GitHub Desktop.
Hide "Back to top" links when printing a page
<p>
This is the top of the page. Pretend there is a ton of content here.
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
Here is the bottom.
Check out <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@media">CSS media queries</a>.
</p>
<a href="#" class="back2top">Back to top<a>
<style>
@media print {
a.back2top { display: none; }
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment