"William Tasso" <ngx RemoveThis @tbdata.com> wrote:
>Another question from the class of: "I'm sure it's in the spec somewhere,
>if only I could find/decypher it."
>
>Whether linked or not, styles go in the <head> this much we know.
>
>Why?
Because a <style> element is information about the document as a
whole, same as the <title> element or a <meta> element. This sort of
element goes in the head because that's what the head exists for. The
body on the other hand exists to contain the actual contents of the
page.
>style blocks appear to have the desired effect when located in the <body>
Browsers support lots of bad coding to compensate for incompetent
authors. We all know that.
>Is it compulsory or desirable to place them in the <head>? If the latter,
>what are there advantages?
The most desirable place to put them is in an external stylesheet.
Imagine a long document with the <style> element at the end. The
document is entirely downloaded before the presentation can be applied
(okay so some browsers manage to do that anyway, the FOUC, with the
styles linked from the head). And what of there are multiple style
elements in the body. Should they apply to the whole document? just to
the container they are in? or from that piunt onwards?
Steve
--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor
Steve Pugh <steve RemoveThis @pugh.net> <http://steve.pugh.net/><!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: Head style