A document type declaration or doctype is actually an instruction that conveys to the web browser what type of document it should expect.
The <!DOCTYPE> declaration is included at the start of each document it is added just above the <html> tag in each document.
The common doctype declaration for different version of HTML and XHTML are:
- For HTML 5 we simply write <!DOCTYPE html>
- HTML 4.01 Strict: The strict version of HTML 4.01 does not permit presentational to be written within HTML Elements. It also does not support inclusion of Frames.
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”>
- HTML 4.01 Transitional: The transitional version of HTML 4.01 this Transitional document type definition (DTD) allows users to utilize certain elements and attributes which were not allowed to be used in strict doctype.
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”
“http://www.w3.org/TR/html4/transitional.dtd”>
- HTML 4.01 Frameset: In HTML 4.01 version Frameset document type definition (DTD),allows users to use frames.
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//EN”
“http://www.w3.org/TR/html4/frameset.dtd”>
- XHTML 1.0 Strict: In XHTML 1.0 version Strict document type definition (DTD), does not support deprecated tags and the code must be written according to the XML Specification.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
- XHTML 1.0 Transitional: In XHTML 1.0 version Transitional document type definition (DTD), allows deprecated elements.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
- XHTML 1.0 Frameset: In XHTML 1.0 version Frameset document type definition (DTD), framesets are used.
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”>
- XHTML 1.1: In XHTML 1.1 version document type definition (DTD), allows the addition of modules
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN”
“http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”>