(I apologize if this is an extremely basic question. I\'m a bit of an HTML noob.)
In HTML5, is the relative ordering within the element, o
In the general case, the order should be assumed to be significant. Because it can be. JavaScript code may, for example, try to access a link
element, and then it matters whether the link
element appears before the script
element (in which case it exists in the DOM when the script is executed).
Only one I can think of is the meta tag for IE...
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
For IE to make use of that one, it has to be the first item in the head (AFAIK)...
for performance, CSS first then JS...(but JS yields best performance at the end of the markup as noted in some of the other answers)
stylesheets should always be specified in the head of a document for better performance, it's important, where possible, that any external JS files that must be included in the head (such as those that write to the document) follow the stylesheets, to prevent delays in download time.
quote from Optimize the order of styles and scripts (from Google's "Make the Web Faster" Best Practices docs)
It is always better you include style sheet in the header and the scripts at the bottom because, users have to wait till the JavaScript finishes loading, tags block parallel downloads.
please look the following links\ Is the recommendation to include CSS before JavaScript invalid?
No, there is no difference.
The only thing you should consider is putting your <script>
tags at the bottom of the <body>
. For more information regarding this issue read this article by Yahoo.
In terms for performance... include CSS files in the header and js files at the bottom of the page...
In terms of order the order of css files and js files matter... in css file if the same rule is present in multiple files the later once will get precedence... in js file the depended files should be included first