14.8.2011 23:38, Geoff Lane wrote:
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.
That's strange, because when I tested with a <style> element right at
the start of <body> element in HTML5 mode, the W3C Validator issued an
error message. This, on the other hand, is a bug in the W3C Validator,
as the current HTML5 draft allows <style> there, though only when the
"scoped" attribute is present.
But that's not really important. HTML5 is a moving target, and so are
HTML5 checkers ("validators"). The "scope" element has not been
implemented in browsers, and there is little reason to think that they
drop support to <style> elements inside <body>. Of course, it is better
to put <style> elements into <head>, or to use <link> elements inside
<head> to refer to external style sheets, but if you cannot do that,
using <style> in <body> is hardly any more risky than using other
well-supported legacy features that are not allowed by the specs.
--
Yucca, http://www.cs.tut.fi/~jkorpela/
______________________________________________________________________
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/