How bad is it to put a CSS include in the middle of the body?

<link> is only permitted in the <head> section of a document: Document relationships: the LINK element


While theoretically you should only put CSS in the head tag, in practice this is often not feasible, or just not worth the pain.

If you do put it in the middle of the document, one of the following two things will happen:

  • The browser will start loading (and displaying) your page, and then once it gets up to the new CSS, the existing content will change or move around

  • The browser will just take a bit longer to display your content.

The first thing seems bad, but it generally isn't a problem. Well it hasn't been for me anyway, because 9 times out of 10, if you're putting CSS in the middle of the page, the CSS is only "built for" the content that comes after it, and doesn't affect the things above it, so they won't move or change anyway

So to answer your question of "how bad is it", I'd say - not bad at all, just be wary of writing CSS that affects parts of the page that got loaded before the CSS file did.

Tags:

Html

Css