On Sunday, August 14, 2011, 8:53:58 PM, Jukka K. Korpela wrote: >> For some time I've been under the impression that you could >> only use <style>...</style> in the head.
> The impression is correct as far as HTML specifications are considered. > However, browsers generally implement style elements in body, too. --- Thanks for your input. I wonder whether that's true of HTML5, as I used <!doctype html> when I passed the markup to the W3C validator and it didn't complain that the <style> block was illegal, which my experience from other misplaced elements suggests it would. Checking http://www.w3.org/TR/html5/semantics.html#the-style-element, which gives the spec for the style element for HTML5, it states: 4.2.6 The style element Categories Metadata content. If the scoped attribute is present: flow content. Contexts in which this element can be used: If the scoped attribute is absent: where metadata content is expected. If the scoped attribute is absent: in a noscript element that is a child of a head element. If the scoped attribute is present: where flow content is expected, but before any other flow content other than other style elements and inter-element whitespace. So, in HTML5, style blocks are legal in the body, but only if they're the first things other than whitespace to come after the opening body tag. Since I'm inserting stuff into someone else's page, there will be a lot of flow content before my style block. Hence, strictly, what I'm doing is illegal. ... but if browsers support it for now then I'm not going to complain as this content has a fairly short life (a few months at most)! Thanks again. -- Geoff ______________________________________________________________________ css-discuss [css-d@lists.css-discuss.org] http://www.css-discuss.org/mailman/listinfo/css-d List wiki/FAQ -- http://css-discuss.incutio.com/ List policies -- http://css-discuss.org/policies.html Supported by evolt.org -- http://www.evolt.org/help_support_evolt/