Optional Closing Tags in HTML

1 replies
  • WEB DESIGN
  • |
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?
#closing #html #optional #tags
  • Profile picture of the author phpbbxpert
    There is actually some discussion floating around on it.

    Keep in mind that this is for HTML only, XHTML is a different animal as it abides by XML standards.

    There is actually a long list of elements that have optional closing tags in HTML4 & seems 5 also according to the beta validator.

    To me it just looks sloppy when tags are not closed and also makes it less readable not knowing when a block element ends.

    It may even slow page load speed a tad because it is less readable for the browsers.
    The browser will have to figure out or guess at when blocks end.

    It's just like specifying image size speeds up load speed a bit, the browser no longer has to figure it out.
    The less the browser has to do, the faster the page loads.

    I have always coded XHTML strict, it leaves it more flexible for doc type as it will validate for all current standards.
    {{ DiscussionBoard.errors[3427503].message }}

Trending Topics