in CSS

Why position CSS <link> between <head></head> and scripts before </body>

Putting s in the head is part of the specification. Besides that, placing at the top allows the page to render progressively which improves user experience. The problem with putting stylesheets near the bottom of the document is that it prohibits progressive rendering in many browsers, including Internet Explorer. Some browsers block rendering to avoid having to repaint elements of the page if their styles change. The user is stuck viewing a blank white page. It prevents the flash of unstyled contents.

Scripts in the other hand are placed in the bottom to allow the HTML to be parsed and displayed to the user first while scripts are downloaded and executed.

References: https://developer.yahoo.com/performance/rules.html#css_top

Write a Comment

Comment