HTML5 defines an HTML syntax compatible with HTML4 and XHTML1 documents but not compatible with SGML features of HTML4 like processing instructions and shorthand markup. The documents that use HTML syntax are almost always served with the text/html media type. Moreover HTML5 also defines detailed parsing rules include error handling for the syntax that are mostly compatible with popular implementations.Here is the example of HTML5 Syntax:
<title>Title of document.</title>
<p><strong>Syntax of HTML5 program.</strong></p>
A text/html-sandboxed media type for documents can also be defined using HTML syntax in HTML5. This is used when hosting untrusted content.
HTML5 also uses XML syntax that is compatible with XHTML1 documents and implementations. Documents using this syntax need to be served with an XML media type such as application/xhtml+xml or application/xml.See the example:
|<?xml version="1.0" encoding="UTF-8"?>
<title>Title of document</title>
<p>Example of syntax that can be use HTML.</p>
The authors of HTML5 has set the three means of character encoding for the syntax of HTML5:
· At the transport level. By using the HTTP Content-Type header for instance.
· Using a Unicode Byte Order Mark (BOM) character at the start of the file. This character provides a signature for the encoding used.
· Using a Meta element with a charset attribute that specifies the encoding within the first 512 bytes of the document. E.g. Instead of using <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">, use <meta charset="UTF-8"> for specifying UTF-8 encoding. However, the previous one is also allowed.
To set the character encoding for the XML syntax, authors will have to follow the rules as set forth in the XML specifications.
See the example:
The MathML refers to Math Markup Language while SVG stands for Scalable Vector Graphics. Both the elements are allowed to be used inside a document in HTML syntax of HTML5.
<title>The Use of SVG and MathML</title>
<rect x="60" y="20" height="160" width="260" fill="#FFCCCC" /> </svg>
Note: See the browser compatible page for successfully rendering the program.
This is the simplest use of SVG and MathML, while more complex combinations can also be used. With the use of SVG foreignObject element, MathML and HTML, or both can be nested inside an SVG fragment that is itself inside HTML.
Recommend the tutorial