Web Development and Design Foundations with XHTML, 5th Edition

(Steven Felgate) #1
621

Comparison of


HTML 4, XHTML,


and HTML 5


As you traverse the Web and view the source codeof
pages created by others, you may notice that the style and syntax of the coding
is different from the XHTML syntax that you have been studying. Most likely,
those pages were written following HTML syntax.
XHTML, eXtensible HyperText Markup Language, uses the tags and attributes
of HTML along with the syntax of XML (eXtensible Markup Language). For
the most part, you will use the same tags and attributes in HTML and
XHTML; the major change is the syntax and additional restrictions in
XHTML. These restrictions were added so that more efficient programs could
be written to process Web pages automatically. XHTML 1.0 Transitional is
backward compatible with HTML 4.01, commonly referred to as HTML 4.
Most Web pages currently use HTML 4 or XHTML 1.0 Transitional. However,
it is good to be aware of the trends in XHTML. At the time this was written,
the W3C was in the process of drafting HTML 5.
In this section we’ll concentrate on the differences between HTML 4, XHTML,
and HTML 5—introducing you to some specific examples of syntax differences
between HTML, XHTML, and HTML 5. Note that HTML 5 has two different
acceptable syntaxes: HTML syntax and XHTML syntax. See http://dev.w3.org/
html5/html-author for more information about writing HTML 5 documents.

D.1 XML Declaration


Since XHTML follows XML syntax, each document should begin with an
XML declaration. HTML 4 has no such requirement.

HTML 4
Not required

D


APPENDIX

Free download pdf