HTML and CSS Reference
In-Depth Information
The elements and attributes of external vocabularies such as Scalable Vector Graphics
(SVG) or MathML can be embedded directly into the HTML5 markup. For example, an
SVG image can be embedded between the <svg> and </svg> tags such as in Listing 3-8.
Listing 3-8. Directly Embedded SVG in HTML5
<svg xmlns=" " >
<rect stroke="black" fill="blue" x="50px" y="50px" width="300px" height="150px"
MathML equations can be embedded similarly. These elements can also be nested for
more complex content [28].
The different HTML5 modules are in various stages of development, and are being standardized
separately (Microdata, Canvas, etc.), including the HTML5 core, which has minor revisions in separate specifications
(HTML 5.1, HTML 5.2).
HTML5 can be written either in HTML syntax (HTML5) or in XML syntax (XHTML5). XHTML5 is the XML serialization
of HTML5. In other words, HTML5 and XHTML5 share the same vocabulary (set of elements and attributes) defined by
the HTML5 specification, but their syntax and parsing rules are different.
HTML5 documents can also be written in a way that they are HTML5 and XHTML5 documents at the same time,
called polyglot markup (overlap language of HTML and XML). A polyglot web document is a valid HTML document
and a well-formed XML document, and produces an identical DOM tree when processed as HTML and when
parsed as XML 6 [29]. HTML5 and XHTML5 documents are cross-compatible, but XHTML5 has a stricter syntax. XML
processing instructions can only be used in XHTML5.
Listing 3-9 shows an XHTML5 skeleton document.
Listing 3-9. An XHTML5 Skeleton Document
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html>
<html xmlns=" " >
<title>An XHTML5 example</title>
<meta charset="UTF-8" />
<h1>Document sample</h1>
6 Except for those xml , xmlns , and xlink attributes for which HTML and XML parsers generate different DOMs, e.g., xml:lang ,
xml:space , xml:base , xmlns="" , xmlns:xlink="" , and xlink:href .
Search WWH ::

Custom Search