HTML <!DOCTYPE> Declaration

The <!DOCTYPE> declaration is the first line of the code in HTML or XHTML document. It specifies the HTML version used in the document. Each HTML document should start with this declaration: so the browsers will render the page compliant with HTML standards. In HTML 4.01, this declaration refers to a Document Type Definition (DTD), which specifies the structure and the legal elements of an XML document.

The <!DOCTYPE> is declared before the <html> tag. The declaration is not case sensitive.


[Root element] [Publicity] "[Registration]//[Organization]//[Type] [Name]//[Language]" "[URL]">

<!DOCTYPE> Parameters

Root element — a parent element that contains all the other elements. For HTML it is the <html> tag.

Publicity — the document can be PUBLIC or SYSTEM (local files, for example). For HTML/XHTML the value is PUBLIC.

Registration - can have two values: plus (+) - the developer is registered in ISO (International Organization for Standardization) and - (minus) - the developer is not registered. For W3C, the value is set to "-".

Organization — the name of DTD developer. The developer of HTML/XHTML is W3C, and its name is declared in <!DOCTYPE>.

Type — the type of the document. For HTML/XHTML the value is DTD.

Name — unique identifier describing DTD.

Language — the language of the document (two letters in uppercase). For HTML/XHTML the language is English (EN).

URL — the URL of the document type description (e.g.

Types of the <!DOCTYPE> Declaration for HTML

There are three types of the <!DOCTYPE> declaration for HTML:

Strict - contains all HTML elements and attributes. However, the presentational or deprecated elements are not included.


Transitional - contains all HTML elements and attributes, including presentational and deprecated elements. Frames are not allowed.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "">

Frameset - is equal to Transitional, but allows the use of frames.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "">

There is only one version of declaration for HTML 5.

<!DOCTYPE html>

Example of the HTML <!DOCTYPE> declaration:

<!DOCTYPE html>
    <title>Title of the document</title>
    <h2>Elements example</h2>
    <p>This is some paragraph.</p>
    <p>This is another paragraph <br/> with  line break.</p>


Types of the <!DOCTYPE> Declaration for XHTML

Here you can find types of the <!DOCTYPE> declaration for XHTML.

XHTML 1.0 Strict

This DTD includes all the HTML elements and attributes, except presentational or deprecated elements. This DTD doesn’t allow frameworks.

XHTML 1.0 Transitional

This DTD includes all the HTML elements and attributes, as well as presentational and deprecated elements. Framesets are not allowed.

XHTML 1.0 Frameset

This DTD is similar to XHTML 1.0 Transitional, but framesets are allowed.

Browser support

Do you find this helpful?

Related articles