Reputation: 251
I have 2 <head>
tags in one web page. Reason is that I used to have the header, the content and the footer views loaded separately, so I left 1 <head>
in the header view and another in the content view.
What's the effect of this? If it's not compliant with html standard, then should I get rid of all extra <head>
and only leave 1 in 1 page?
Upvotes: 1
Views: 148
Reputation: 6698
Here's specifically what happens, when an HTML5-compliant browser parses a document with two head
elements:
</head>
tag: The "after head" insertion mode<head>
tag: "Parse error. Ignore the token."<meta>
: Parse error, but it basically adds the tag to the previous head
element.</head>
tag: "Parse error. Ignore the token."So what does this mean? It is a parse error to have multiple head
s. However, the standard is clear on what should happen in this case. It does the "right" thing and merges the them.
I should also point out that <head></head>
tags are optional. You can leave them out and have no parse errors.
Upvotes: 0
Reputation: 11498
This is what HTML looks like:
<!DOCTYPE html>
<html>
<head><!-- The *required* head -->
<title>The *required* title</title>
</head>
<body><!-- The *required* body -->
Stuff
</body>
</html>
Don't do anything besides that - that includes using two head tags. I think what you want is iframes.
Upvotes: 1