Use of HTML/XHTML Standards
The use of web standards and practice of validating web content insures interoperability with a wide range of technologies that render web content.
Resources for Standards Based Design
- Web Standards Project
- Designing with Web Standards, Zeldman, New Riders Press, 2003
- Dynamic HTML: The Definitive Reference (2nd Edition), Goodman, O'Reilly, 2000
W3C HTML Validation Service
The W3C HTML Validation Service for HTML documents can be used to determine if HTML/XHTML documents comply with specifications.
The following elements must be part of the document for the automatic validation of web resources:
- Include a DTD at the beginning of the document. Common document types:
- HTML 4.01 Transitional: In general, supports the inclusion of deprecated elements and attributes
- HTML 4.01 Strict: Cannot use deprecated elements and attributes
- XHTML 1.0 Transitional: Reformulation of HTML 4.01 transitional to comply with XML rules
- XHTML 1.0 Transitional: Reformulation of HTML 4.01 strict to comply with XML rules
- Language specification
- Characterset information
HTML 4.01 Transitional Source Code Example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<HTML LANG="EN-US">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-1">
....
</HEAD>
<BODY>
....
</BODY>
</HTML>
<HTML LANG="EN-US">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-1">
....
</HEAD>
<BODY>
....
</BODY>
</HTML>
HTML 4.01 Strict Source Code Example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Strict//EN" "http://www.w3.org/TR/REC-html40/strict.dtd">
<HTML LANG="EN-US">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-1">
....
</HEAD>
<BODY>
....
</BODY>
</HTML>
<HTML LANG="EN-US">
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html;charset=iso-8859-1">
....
</HEAD>
<BODY>
....
</BODY>
</HTML>
XHTML 1.0 Transitional Source Code Example
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...
</head>
<body>
...
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...
</head>
<body>
...
</body>
</html>
XHTML 1.0 Strict Source Code Example
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...
</head>
<body>
...
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-US" lang="en-US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
...
</head>
<body>
...
</body>
</html>