0

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?

5
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by sreein1986
0

Your concerns are valid. All tags should be closed (must be closed in XHTML).

0

Don't feel that you missed the boat; that was probably a boat you were better off missing anyway. It's good to get into the habit of writing correct code; breaking the habit of writing bad code is difficult.

Depending on your DOCTYPE declaration, this may raise concerns. As PKern states, closing tags are required in xhtml.

Although trimming access code saves you in bandwidth usage, this could make the difference between forcing the browser to go into quirks mode or standards mode. Browsers perform better in standards mode because the parsing requires less overhead. You can find out more about this by google-ing "Quirks Mode vs. Standards Mode".

I.e. Trimming code benefits you; good code benefits the user. If done correctly, trimming code benefits you and the end user.

If you want to save bandwidth by cutting out access code, you can start by cutting out unnecessary white space. This helps dramatically, while still preserving code correctness.

0

this is the first time i m hearing of tags being optional, and luckily too.
i m way too used to closing tags and if i had know that sooner, i most probably would of not closed a lot of tags and become a sloppy programmer.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.