HTML Document Syntax

This section describes the HTML document syntax. A HTML document must have a DOCTYPE declaration and an 'html' element.

At a high level, the HTML document syntax is very simple for the HTML5 standard as described below.

An HTML document consist of 6 parts in the given order:

Here is a simple example of HTML document that matches the above HTML document syntax requirements:

<!DOCTYPE html>
<!-- HTML5_Document_Syntax_Example.html
 - Copyright (c) 2014 HerongYang.com. All Rights Reserved.
-->
<html>
 <!-- "html" is the root element -->
 <head>
  <title>HTML5 Document Syntax Example</title>
 </head>
 <body>
  Hello World!
 </body>
</html>
<!-- End of the document -->

Table of Contents

 About This Book

 Introduction of HTML

 Introduction of HTML5 Features

 HTML Document Structure and Content

HTML Document and Elements Syntax

HTML Document Syntax

 Document Character Set and Encoding

 Entering Comments in HTML Document

 Opening and Closing Tags of Elements

 Using Nested Elements

 Specifying Element Attributes

 Specifying Element Contents

 Element Content Syntax Types

 Using Whitespace Characters

 Using Character Entity References

 Using Numeric Character References

 Displayed and Printed HTML Documents

 Responsive Design of Web Pages

 MathML Integration in HTML Documents

 References

 Full Version in PDF/EPUB