Optional Closing Tags in HTML

Carrym

New member
For as long as I've been validating web pages, I never realized that the closing </head> tag was optional in HTML. I feel as if I've missed the boat at times. ;)

While I'm all for trimming excess code, I just cannot for the life of me strip out closing tags because they are optional in HTML. I'd be concerned that something, somewhere would not parse the document correctly if I removed the closing </head> element.

Are my concerns unfounded?
 
I've never heard of "optional closing tags in HTML" before for anything. I was taught to believe that everything should have a closing tag, whether it would be <head>, <body>, <table>, etc. The only ones that I know of that don't need one of course are ones like <br>, <hr>, <img>, and a few others that I can't think of at the moment.

I'd also be afraid of not having the document show correctly because something wasn't closed when it should have been. The best case scenario is to just close everything that should be closed.
 
They aren't "optional" because browser designers had to find a way to compensate for all the lazy site builders. :) Take a took at something called a HTML Dom tree for more details.
 
Back
Top