HTML and CSS Reference
It is often good to start with the simplest possible example, for HTML5 that would be:
Open your favourite text editor, enter the code above, save it as “hello.html” and open it in
your favourite HTML5 compliant browser.
This may not look like an HTML page. For instance, there is no html tag and no body tag?
Despite this, the browser knows what to do with the minimal content provided. If we ana-
lyse the Document Object Model generated for this page in the Chrome browser (open the
Chrome Developer Tools and click the “Elements” tab) we will see the following:
The browser has derived the intent of the HTML page and generated a compliant internal
Document Object Model.
The HTML5 specification is very relaxed compared to earlier iterations of the specifications.
Over the years there has been a move to stricter definitions of HTML, most noticeably
HTML 4.01 Strict (published in 2000), and XHTML. These standards emphasised strict
markup rules, such as always closing tags, and always placing quotes around attribute val-
ues. This drive for strictness was driven by a number of reasons:
• Earlier versions of HTML and XHTML were based on other markup languages (SGML
and XML respectively), and this imposed restrictions on HTML.
• It is easier for browsers to derive the intent from documents written with strict rules, and
this would help compatibility across browsers.
• It is easier for other tools to process documents if they comply with strict rules.
Despite the increasing strictness of the HTML and XHTML specifications, browsers never
really enforced these rules. Browser vendors had long ago come to the realisation that it was
in their best interests to make the best of any markup they were given, regardless of its valid-
ity against relevant standards. From a browser vendor point of view the rationale is obvious:
users will lose patience with a browser that refuses to render pages due to technicalities, and
choose a browser that will.