Does <STYLE> have to be in the <HEAD> of an HTML document?

Viewed 94478

Strictly speaking, do style tags need to be inside the head of an HTML document? The 4.01 standard implies that, but it's not explicitly stated:

The STYLE element allows authors to put style sheet rules in the head of the document. HTML permits any number of STYLE elements in the HEAD section of a document.

I say "strictly speaking" because I have an app that puts style elements inside the body, and all the browsers I've tested with seem to use the style elements. I'm just wondering if that's actually legal.

10 Answers

The HTML5.2 W3C Recommendation, 14 December 2017 (not the earlier draft referred to above) now says you can include <style>.

"In the body, where flow content is expected." (section 4.2.6)

Related