HTML and CSS Reference
In-Depth Information
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
The reason for this has already been touched upon: HTML5 is not based on SGML like
earlier versions of HTML: in fact it is not based on anything.
//
Standard Generalized Markup Language (SGML) is a technology for defining
the rules of markup languages such as XML or HTML.
Although HTML5 is not based on any other standards, it is possible to write HTML5 in
XML serialisation mode. The following would be the skeleton for an HTML5 page that
serializes to XML (this is the equivalent of XHTML):
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta charset="utf-8" />
</head>
<body>
</body>
</html>
In addition, HTML5 documents that utilize “XML mode” should have a document type of
application/xhtml+xml (rather than text/html ).
We will not utilize XML mode in this topic. In reality there are no real advantages to using
an XML compliant version of HTML unless you need to process pages with an XML pars-
er, but it is useful to know that this mode exists.
On the next line in the example above you will also notice that the html tag (which is op-
tional) contains the language:
<html lang="en">
The specification does not dictate what the language attribute will be used for, but obvi-
ously browsers can use the language for a variety of reasons, including offering translations
to other languages.
Other than this, the only other feature you should add to every page is the following line in
the head section to specify the character encoding:
<meta charset="utf-8">
 
Search WWH ::




Custom Search