Skip to content

Instantly share code, notes, and snippets.

@hofmannsven
Last active December 23, 2015 02:48
Show Gist options
  • Save hofmannsven/6568844 to your computer and use it in GitHub Desktop.
Save hofmannsven/6568844 to your computer and use it in GitHub Desktop.
Hide elements only if the user has JavaScript enabled (e.g. great for a JavaScript animation)

Progressive Enhancement

Hide elementes only if JavaScript is enabled.

<!-- class will be added, but only if JavasSript is enabled -->
<script type="text/javascript">
document.documentElement.className = 'js';
</script>
<!-- hide elementes if JavaScript is enabled -->
<style type="text/css">
.js .container { display: none; }
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment