Skip to content

Instantly share code, notes, and snippets.

@johnrom
Created March 4, 2016 16:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save johnrom/b3d699332c468b02a7c2 to your computer and use it in GitHub Desktop.
Save johnrom/b3d699332c468b02a7c2 to your computer and use it in GitHub Desktop.
FOUC/FOUT
<!DOCTYPE html>
<html lang="en" class="no-js">
<head>
<meta charset="UTF-8">
<title>FOUC</title>
<script>
document.documentElement.className = document.documentElement.className.replace(/\bno-js\b/,'js');
</script>
</head>
<body>
<div id="container">
<h1>My Content</h1>
<p>This content will appear after FOUC</p>
</div>
<style>
.no-js #container {
visibility: hidden;
}
</style>
<noscript>
<style>
.no-js #container {
visibility: visible;
}
</style>
</noscript>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment