Page 1 of 1

Is it valid too...

Posted: Wed Oct 03, 2007 1:08 pm
by figaro11
Is it valid too include <script>, <link> or <style> elements in the body of you document? If so then what would be the difference in placing them in the head or body of you document?

Posted: Wed Oct 03, 2007 2:35 pm
by pickle
Try it & see if it validates. The answer will probably vary depending on which DOCTYPE you're using.

For speed, Yahoo suggests putting all CSS as far up in the document as possible, and all Javascript as far down.

Posted: Wed Oct 03, 2007 2:40 pm
by figaro11
pickle wrote:For speed, Yahoo suggests putting all CSS as far up in the document as possible, and all Javascript as far down.
Hmm. I put my css before my javascript, but only in the head. Is that what yahoo means by far down? Or do they mean at the bottom of the body?

Posted: Wed Oct 03, 2007 2:49 pm
by pickle

Posted: Wed Oct 03, 2007 9:58 pm
by VladSun
<link> and <style> *must* appear within the HEAD element, while it is not true for <script>.

Posted: Thu Oct 04, 2007 12:57 pm
by JAB Creations
My strict practices...

Code: Select all

<html>
<head>
<link>
<script>
</head>

<body>

</body>
</html>
I do not use the style element ever with the obvious exception for troubleshooting/forum posts.