Greg M
Greg M

Reputation: 11

Why do page speed sites list CSS as a render blocking resource?

CSS was designed to cascade layout changes and is not render blocking, is it? so why do page speed tests say CSS can be rendered blocking?

Upvotes: 1

Views: 50

Answers (1)

Mark Schultheiss
Mark Schultheiss

Reputation: 34168

If you have a mix of html and <style> tags inside the <body> the render will stop and process the CSS - so for example if JavaScript is running when the browser encounters a set of CSS in style tag(s) the engine needs to apply that style and create a flow from that.

To re-state: Once a <style> tag is encountered inside the <body> everything stops and the CSSOM is rebuilt and re-applied to all existing rendered (painted) content. What is CSSOM? https://developer.mozilla.org/en-US/docs/Web/API/CSS_Object_Model

Upvotes: 1

Related Questions