Optional Tags

Post here if your topic is about CSS HTML Validator but doesn't fit in another forum.
Post Reply
User avatar
RSteinwand
Rank VI - Professional
Rank VI - Professional
Posts: 585
Joined: Mon Jun 09, 2008 2:12 pm
Location: Fargo, ND
Contact:

Optional Tags

Post by RSteinwand » Wed Dec 24, 2014 10:36 am

Doesn't this make you cringe? http://www.w3.org/TR/html5/syntax.html# ... g-omission
An html element's start tag may be omitted if the first thing inside the html element is not a comment.
A head element's start tag may be omitted if the element is empty, or if the first thing inside the head element is an element.
A body element's start tag may be omitted if the element is empty, or if the first thing inside the body element is not a space character or a comment, except if the first thing inside the body element is a meta, link, script, style, or template element.
I wouldn't want to have to code that. :shock:
Rick

User avatar
Albert Wiersch
Site Admin
Site Admin
Posts: 3299
Joined: Sat Dec 11, 2004 9:23 am
Location: Near Dallas, TX
Contact:

Re: Optional Tags

Post by Albert Wiersch » Fri Dec 26, 2014 7:27 pm

Yes... that's not pretty but it's there for backward compatibility with previous versions of HTML which were based on SGML. Best to explicitly use the proper start and end tags if you ask me, even if they are optional. :D
Image
Albert Wiersch

Post Reply