wordpressdivichild-theming

How to Fix Flash of Header Unstyled Content (FOUC) in Divi Theme on WordPress?


I have built my website using WordPress with the Divi Child Theme, but I am experiencing a Flash of Unstyled Content (FOUC) issue. The header appears unstyled for a moment before the full design is applied.

You can check the issue on my website: https://cgistudio.at/

What I Have Tried So Far: I have already tried the following solutions, but none of them fully resolved the issue:

Disabled "Load Stylesheets Asynchronously" in Divi settings. Adjusted caching settings in WP Fastest Cache:

Enabled: Minify CSS Disabled: Combine CSS Checked for render-blocking issues. Added a preloader to delay content visibility until CSS is fully loaded. Disabled optimization plugins like Autoptimize, but the issue persists.

How can I completely eliminate FOUC and ensure that the header and styles are fully applied before displaying the page?

Any help would be greatly appreciated.


Solution

  • Perhaps you tried this already: https://digitalrefresh.uk/how-to-fix-divi-flashing-unstyled-headers-and-content-on-page-load/

    Seems to have worked for me.

    Divi > Theme Options > Integration > Add code to the < head > of your blog

    <script type="text/javascript">
    var elm=document.getElementsByTagName("html")[0];
    elm.style.display="none";
    document.addEventListener("DOMContentLoaded",function(event) {elm.style.display="block"; });
    </script>