Skip to content

Instantly share code, notes, and snippets.

@mig8447
Forked from electrotype/FOUC-fix.md
Last active September 11, 2021 12:43
Show Gist options
  • Save mig8447/dc669de679fc55623032ed70d8697012 to your computer and use it in GitHub Desktop.
Save mig8447/dc669de679fc55623032ed70d8697012 to your computer and use it in GitHub Desktop.

Fix for FOUC :

At the top of your HTML:

<!doctype html>
<html>
<head>
    <style>html{visibility: hidden;opacity:0;}</style>

Just before the body closes:

    <style>html{visibility: visible;opacity:1;}</style>
</body>

Or at the end of your last .css file:

html {
    visibility: visible;
    opacity: 1;
}
@cmdlinebeep
Copy link

Typo in the "before body closes" part, should say visible and opacity:1 :-)

@mig8447
Copy link
Author

mig8447 commented Sep 11, 2021

Typo in the "before body closes" part, should say visible and opacity:1 :-)

Thanks, fixed it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment