View Full Version : Can I have two <head> elements?

02-15-2007, 02:40 AM
Hi, this is a philosophical question of sorts. Isn't it a bit weird to have the <style> tag BEFORE the content? Wouldn't it be more natural to have a structure like


head 1

title, global javascripts, meta tags etc

/head 1
head 2


/head 2



Would I run into problems if I did it this way?

02-15-2007, 03:28 AM
The short answer would be NO! you can't have two head tags., and YES! you would have problems.

02-15-2007, 04:15 AM
just out of curiosity, why would u ask... seems a bit silly but I'm intrigued

i don't know if you'd have "problems" per-se but it definitely wouldn't validate

02-15-2007, 07:23 AM
It isn't weird to have the style before the content, think about it this way, the browser needs to know how to show the content that it is going to read.

02-15-2007, 10:39 AM
Also, "head" already implies being a section on top of the document; having a "head" at the bottom like you suggest, now that I would consider weird.

02-15-2007, 01:37 PM
Wouldn't it be more natural to have a structure like

It would be unatural. The style information must always go before the body as it uses the CSS selectors to render the HTML. Thats the reason it goes in HEAD. So the simple answer is head must go to the top. You can nest as many head elements in the head seciton as you like so there would be no need to have two heads at the top either