I am wondering if there is a fixed/correct order for elements appearing in the "head" section of an html document. I'm working on a project and often have style and script elements and am not sure if they should appear in that order and before or after the title of the document. The following is typical of this project:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<style>
#container {
background-color: black;
}
</style>
<script src="http://code.jquery.com/jquery-latest.js">
</script>
<title>Title Here</title>
</head>
Is this all right? Should the title precede the style and script? Any help would be appreciated.
Thanks in advance.
Meta charset (this should always be before the title)
Title
Other meta tags
Styles
and move my JavaScript to the end of the document before the closing the body
And if I had a bit o' script, it would appear just after the JS call before closing the body, like so:
<script src="http://code.jquery.com/jquery-latest.js"></script>
<script>
$(document).ready(function() {
$('p').fadeOut(8000);
});
</script>
</body>
Right?