HTML and CSS Reference
HtML5 vs. XHtML
Attributes need not have attribute
All attributes must have attribute
Attribute names are not case
Attribute names must be
Unquoted attribute values are
All attribute values must be
enclosed in quotes.
A DOCTYPE is required in the form
<!DOCTYPE html >
The DOCTYPE is optional.
Element names are not case
Element names must be lowercase.
Empty element tags
A closing slash may or may not be
used with an empty element tag.
Empty element tags must include
a closing slash.
In HTML5 there are no well-
formedness constraints; no errors
Well-formedness errors are fatal.
Namespace prefixes are not sup-
ported in HTML5.
Namespace prefixes are supported
Elements and attributes for known
vocabularies (HTML, SVG, and
MathML) are implicitly assigned.
Namespaces must be explic-
itly declared using the xmlns
HTML5 does not support process-
ing instructions and instead treats
the enclosed text as a comment.
Allows the use of processing
instructions closed with ƒ?>
The rules for HTML5 are much more open than for XHTML. For example, an HTML5
document is considered valid regardless of whether attributes have attribute values,
whether attribute names and element names are in lowercase letters, or whether empty
element tags have closing slashes. Even though HTML5 does not have the same syntax
requirements as XHTML, you should follow the general XHTML syntax rules in case you
need to work with XHTML or XML documents in the future.
Note that with XHTML, you cannot use the HTML5 structural elements including the
header , footer , nav , section , article , aside , hgroup , figure , and figcaption
elements. One alternative to using those elements is to use div elements, and identify
the purpose of each div element using an id attribute. Thus, under XHTML, you can use
the following div element to make a page header:
However, there is no specification in XHTML to use one id value over another. A
different author might use an id value of head or title . Syntactical elements such as the
header element are one of the chief advantages of HTML5 in that they provide a com-
mon structure for Web pages.