fbpx

How to fix Divi flashing unstyled headers and content on page load

You’ve spent weeks if not months getting your new website ready for launch and you’ve started to notice that each time a page loads you are briefly seeing it unstyled before before returning to how it should be.

This is called Flash of Unstyled Content and it will display the browser’s default styling briefly before your stylesheets are loaded. This doesn’t look very professional and may be very annoying for both yourself and the user.

To stop this happening, we add a few lines of code.

Adding the Code Snippet

Place the below CSS snippet into your child themes Style Sheet or if you are not using a child theme then you can go to Divi > Theme Options > Integration > Add code to the < head > of your blog

Place the following code snippet.

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

Adding in this code snippet should instantly fix any problems you are having. Note you may need to clear your website and browser cache to notice the changes.

Everything you need to
build the best divi websites

Our premium layout packs and child themes will help save hours of designing websites from scratch. All you need to do is change the colours, images and text to suit your business.

View Themes

0 Comments

Submit a Comment

0
    0
    Your Cart
    Your cart is emptyReturn to Shop