How to achieve web standards and quality on your website? (original) (raw)

Warning

The list is informative and does not try to be exhaustive (there are many other proper declarations you could use), but it has most of the declarations commonly used on the Web at the moment.

When authoring document is HTML or XHTML, it is important to Add a Doctype declaration. This makes sure the document will be parsed the same way by different browsers.

The simplest and most reliable doctype declaration to use is the one defined in HTML5:

If you need a doctype matching a specific version of (X)HTML, the doctype declaration must be exact (both in spelling and in case) to have the desired effect, which makes it sometimes difficult. To ease the work, below is a list of recommended doctype declarations that you can use in your Web documents.

Template

Use the following markup as a template to create a new HTML document using a proper Doctype declaration. See the list below if you wish to use another DTD.

An HTML standard template
 <p>… Your HTML content here …</p>

(X)HTML Doctype Declarations List

HTML5 and beyond

HTML 4.01

Strict

Transitional

Frameset

XHTML 1.0

Strict (quick reference)

Transitional

Frameset

XHTML 1.1 - DTD:

XHTML Basic 1.1 (quick reference):

MathML Doctype Declarations

MathML 2.0 - DTD:

MathML 1.01 - DTD:

Compound documents doctype declarations

XHTML + MathML + SVG - DTD:

XHTML + MathML + SVG Profile (XHTML as the host language) - DTD:

XHTML + MathML + SVG Profile (Using SVG as the host) - DTD:

Optional doctype declarations

Beyond the specificities of (X)HTML processing, Doctype declarations in XML languages are only useful to declare named entities and to facilitate the validation of documents based on DTDs. This means that in many XML languages, doctype declarations are not necessarily useful.

The list below is provided only if you actually need to declare a doctype for these types of documents.

SVG 1.1 Full - DTD:

SVG 1.0 - DTD:

SVG 1.1 Basic - DTD:

SVG 1.1 Tiny - DTD:

Historical doctype declarations

The doctype declarations below are valid, but have mostly an historical value — a doctype declaration of a more recent equivalent ought to be used in their stead.

HTML 2.0 - DTD:

HTML 3.2 - DTD:

XHTML Basic 1.0 - DTD: