HTML and CSS Reference
N OTE Given the currently fluid nature of HTML5, developers are warned that, at least for now,
HTML5 conformance may be a bit of a moving target.
If you are wondering what mode the browser enters into because of the divergent
<!DOCTYPE> used by HTML5, apparently it is the more standards-oriented mode:
Employing the more standards-oriented parsing mode might seem appropriate, but it is
somewhat odd given the point of the next section.
Loose Syntax Returns
An interesting aspect of HTML5 is the degree of syntax variability that it allows. Unlike its
stricter markup cousin, XHTML, the traditional looseness of HTML is allowed. To demonstrate,
in the following example, quotes are not always employed, major elements like html , head ,
and body are simply not included, the inference of close of tags like </p> and </li> is
allowed, case is used variably, and even XML-style self-identifying close syntax is used at will:
<!-- I have no html, head, or body as they are actually optional -->
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<title> HTML5 Tag Soup Test </title>
<h1 title="more sloppy markup ahead!"> HTML5 </H1>
<p id=p1> Back to the future of loose markup!?
<p> Yes it looks that way
<li> optional elements
<LI> case is no problem
<li id=noquotes> quotes optional in many cases
<li> inferred close tags
<p> Oh my
<p> Intermixing markup styles!
<!-- ok that's enough let's stop now -->
O NLINE http://htmlref.com/ch2/loosesyntax.html