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.
0 Comments