There is very old thread where people state that you should never include CSS in body, however MDN states that is is allowed. So is it considered good or bad practice to include CSS in the middle of the page?
For example, let's take a structure like this:
<html>
<head>
<link href="global.css" rel="stylesheet">
</head>
<body>
<h1>Some title</h1>
<p>Some content</p>
<img src="some-image.jpg" />
<link href="specific-component.css" rel="stylesheet">
<div>
Specific component that requires the style
</div>
<p>Other content</p>
</body>
</html>
What are disadvantages of including specific-component-style.css mid page comparing to including it to head section?
How page will be rendered with it? Will it be:
- Start loading global.css, some-image.jpg, specific-component.css (in this order).
- After global.css is loaded start rendering page until specific-component.css
<link>
element. - Finish loading specific-component.css
- Render the rest of the page.
Or will it be:
- Wait for both global.css and specific-component.css finish loading and only then start rendering the page.
- What if there are 20 images before specific-component.css, will browsers prioritize CSS file or not?