Using the correct DOCTYPE

XHTML Doctypes

XHTML 1.1

Files with this doctype SHOULD be served with the application/xhtml+xml mime type.
[xhtml]<?xml version=”1.0″ encoding=”utf-8″?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml” xml:lang=”en”>[/xhtml]

XHTML 1.0 Strict

This is best served as the default text/html so the XML statement is not needed.
[xhtml]
<!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”>
[/xhtml]

XHTML 1.0 Transitional

[xhtml]
<!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”>
[/xhtml]

XHTML 1.0 Frameset

Frames are considered to be “not best practice” and so should be avoided. This doctype should only be used on the frameset page.
[xhtml]
<!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”>
[/xhtml]

HTML Doctypes

HTML 4.01 Strict

[html]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN”
“http://www.w3.org/TR/html4/strict.dtd”>
[/html]

HTML 4.01 Transitional

[html]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
“http://www.w3.org/TR/html4/loose.dtd”>
[/html]

HTML 4.01 Frameset

Frames are considered to be “not best practice” and so should be avoided. This doctype should only be used on the frameset page.
[html]
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//EN”
“http://www.w3.org/TR/html4/frameset.dtd”>
[/html]

Character set meta tag

This is included for completeness. Stick it the head element so the validators don’t complain.
[xhtml]
<meta http-equiv=”content-type” content=”text/html; charset=utf-8″ />
[/xhtml]

Speak Your Mind

*