Reputation: 649
Seems HTML5 Recommendation has a little ambiguity about <link>
position: http://www.w3.org/TR/html5/document-metadata.html#the-link-element
There is a phrase
Contexts in which this element can be used: Where metadata content is expected.
And there is no exact definition of this contexts. But the whole page describes a content of this kind e.g. head, title, base, link, meta, style.
There is also a paragraph:
A link element must have a rel attribute. If the rel attribute is used, the element is restricted to the head element.
Seems that it has redundant or mutually exclusive phrases.
So could anybody clarify the situation with <link>
tag position?
Is Google right about https://developers.google.com/speed/docs/insights/OptimizeCSSDelivery#example or does it violate the W3C Recommendation?
Upvotes: 3
Views: 331
Reputation: 21
The <link>
element must go inside the <head>
element, which in turn must go inside the </html>
.
The only thing you can put outside of an <html>
is a comment or the DOCTYPE
Upvotes: 1
Reputation: 49826
link
is not permitted outside of the html
element. The html
element is the single permitted root element.
Inserting an element into head
cannot place it out of html
because head
must also be in html
.
Upvotes: 5