DOCTYPE in HTML

DOCTYPE (<!DOCTYPE) in HTML is basically an instruction to the browser regarding the version of HTML used on the page. DOCTYPE in HTML is not a tag.

The <!DOCTYPE> must be the first thing on any HTML page so that the browser immediately understands how to render the HTML page.

The <!DOCTYPE> must be placed even before the <html> tag on any HTML page.

<!DOCTYPE> before HTML 5 referred to a DTD  where the DTD specified the markup language rules so that the browser can display that HTML page content correctly.

<!DOCTYPE> declarations in HTML

 <!DOCTYPE> in HTML 5 declaration

<!DOCTYPE html>

DOCTYPE in HTML 4.0.1 Strict declaration

– here the DTD contains all the elements and attributes of HTML, but does not have presentational aspect (e.g. font). Also, framesets are not allowed in this declaration.

The <!DOCTYPE> declaration in HTML 4.0.1 Strict is:

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

DOCTYPE in HTML 4.0.1 Transitional declaration

– here the DTD contains all the elements and attributes of HTML, and also has presentational aspect (e.g. font). Framesets are however still not allowed in this declaration.

The <!DOCTYPE> declaration in HTML 4.0.1 Transitional is:

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

DOCTYPE in HTML 4.0.1 Frameset declaration

– same as HTML 4.0.1 Transitional but also allowed framesets

The <!DOCTYPE> declaration in HTML 4.0.1 Frameset is:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//EN” “http://www.w3.org/TR/html4/frameset.dtd”>

DOCTYPE in XHTML 1.0 Strict declaration

– here the DTD contains all the elements and attributes of HTML, but does not have presentational aspect (e.g. font). Framesets are not allowed in this declaration and the markup must be written as a well formed XML.

The <!DOCTYPE> declaration in XHTML 1.0 Strict is:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>

DOCTYPE in XHTML 1.0 Transitional declarations

– here the DTD contains all the elements and attributes of HTML, and also have presentational aspect (e.g. font). Framesets are however still not allowed in this declaration and the markup must be written as a well formed XML.

The <!DOCTYPE> declaration in XHTML 1.0 Transitional is:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>

DOCTYPE in XHTML 1.0 Frameset

– same as XHTML 1.0 Transitional but also allowed framesets

The <!DOCTYPE> declaration in XHTML 1.0 Frameset is:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”>

DOCTYPE in XHTML 1.1

-same as XHTML 1.0 Strict but it allowed the programmer to add their own modules

The <!DOCTYPE> declaration in XHTML 1.1 is:

<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>

Tagged , , , , . Bookmark the permalink.