HTML and CSS Reference
<!--=================== Horizontal Rule ================================-->
<!ELEMENT hr EMPTY>
As you can see, there is some case changing (lowercase elements), a lack of optional close
tags, and a general cleanup of syntax, but otherwise things are pretty much the same.
Properly constructed (X)HTML documents should reference a DTD of some sort and it
is important to know what this means as browsers and Web quality assurance tools actually
consult the doctype directives. Hopefully, this brief introduction has given you a sense of
the underlying specification of (X)HTML and its degree of detail. Appendix E presents
complete coverage of how to read the (X)HTML DTDs.
N OTE Interestingly, HTML5 does not use SGML or XML definitions, but instead relies on an
English prose specification combined with some formalism. Chapter 3 discusses this change and
some other aspects of the HTML5 language and specification that is different from the older
Document Type Statements and Language Versions
(X)HTML documents should begin with a <!DOCTYPE> declaration. This statement
identifies the type of markup that is supposedly used in a document. For example,
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
indicates that we are using the transitional variation of HTML 4.01 that starts with a root
element html . In other words, an <html> tag will serve as the ultimate parent of all the
content and elements within this document.
A <!DOCTYPE> declaration might get a bit more specific and specify the URI (Uniform
Resource Identifier) of the DTD being used as shown here:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
In the case of an XHTML document, the situation really isn't much different:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
However, do note that the root html element here is lowercase, which hints at the case
sensitivity found in XHTML.
There are numerous doctype declarations that are found in HTML and XHTML
documents, as shown in Table 1-2.
N OTE On occasion you might see other HTML document type indicators, notably one for the 3.0
standard that was never really adopted in the Web community.