Is it possible to connect css files inside the page body, and not into its head?

  • why not? - Grundy
  • @Grundy Well, I have never seen anything like this, just html loyally relates to errors and maybe this is possible. - perfect
  • Yes, it is possible, but is it necessary ... - MoJlo4HuK
  • Any optimizers of loading pages advise in the upper part to load a bit of the most important css, and the rest of the styles - somewhere closer to the closing body . So plug on health. - br3t

3 answers 3

This was prohibited in HTML4.1, but this restriction was removed in HTML5.

  • _____ thank you. - perfect

The most interesting effect of the styles inside <body> is that it is planned for browsers (and in Chrome Canari already have) for such placement in the browsers to remove the blocking of rendering by these resources. That is, when the styles are in the <head> they are a rendering blocking resource, without downloading and parsing which the browser will not start rendering. And when this behavior becomes the same in all browsers, we will actually have an analogue of the async attribute for scripts. And when HTTP / 2 becomes the standard, it will be possible to stop sweating about separate files :-)

    Checked on https://validator.w3.org/ , the answer of the validator added a picture

    enter image description here