I'm trying to optimize the page load time of a website. Now I've implemented almost all suggestion Google PageSpeed Insights gave me. However it keeps suggesting using a non-blocking stylesheet so that the above-the-fold content can be rendered before loading the stylesheet (using inline CSS):
Eliminate render-blocking JavaScript and CSS in above-the-fold content.
Your page has X blocking CSS resources. This causes a delay in rendering your page.
Approximately Y% of the above-the-fold content on your page could be rendered without waiting for the following resources to load. Try to defer or asynchronously load blocking resources, or inline the critical portions of those resources directly in the HTML.
It refers to the following information on how it should be done. Basically:
<html>
<head>
<style>
.blue{color:blue;}
</style>
</head>
<body>
<div class="blue">
Hello, world!
</div>
</body>
</html>
<link rel="stylesheet" href="small.css">
Although I have never seen a link to a stylesheet tag outside off the HTML tag, I changed my website using this strategy.
However, the online version of Google PageSpeed insights still complains about the stylesheet. Even more strange, the similar browser plugin (PageSpeed Insights for Chrome) says the exact opposite thing:
When you remove inline style blocks and elements from the main text of the document and put it in the header, the display performance will be improved.
Now my questions are:
- Which one is correct? (In perspective of SEO and ofcourse in the perspective of UX)
- Is there another way which keeps them both pleased? (HTML5 and JavaScript solutions are accepted if they are cross-browser and do improve page load time)