![](https://image.slidesharecdn.com/doctypehtmlpublic-111124133551-phpapp02/95/doctype-html-public-3-728.jpg?cb=1322142615)
Doctype html public
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. The HTML 4.01 strict doctype validates against the HTML 4.01 spec, although it doesn't allow any presentational markup or deprecated elements (such as elements) or framesets to be used. Now, that may look like a lot of nonsense to you, so let me offer a somewhat simplified explanation of how it is constructed. For a much more detailed look at exactly what each character refers to, see the article !DOCTYPE . 6 Answers Sorted by: 54 Traditionally, a Doctype, or Document Type Declaration associates the document with a Document Type Definition. The Document Type Definition is a standard for a specific XML or SGML document.![](https://c8.alamy.com/comp/R5HG8F/!doctype-html-public-R5HG8F.jpg)
A document type declaration, or DOCTYPE, is an instruction that associates a particular XML or SGML document (for example, a web page) with a document type definition (DTD) (for example, the formal definition of a particular version of HTML 2.0 - 4.0). In the serialized form of the document, it manifests as a short string of markup that conforms to a particular syntax. The HTML document type declaration, also known as DOCTYPE, is the first line of code required in every HTML or XHTML document. The DOCTYPE declaration is an instruction to the web browser about what version of HTML the page is written in. This ensures that the web page is parsed the same way by different web browsers. 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 is declared before the tag. The declaration is not case sensitive. Syntax [Root element] [Publicity] " [Registration] // [Organization] // [Type] [Name] // [Language] " " [URL] "> All HTML documents must start with a declaration. The declaration is not an HTML tag. It is an "information" to the browser about what document type to expect. In HTML5, the declaration is simple: . In older documents (HTML 4 or XHTML), the declaration is more complicated because the declaration must refer.
![](https://c8.alamy.com/comp/R65DD7/!doctype-html-public-R65DD7.jpg)
The doctype declaration refers to a Document Type Definition (DTD). The DTD specifies the rules for the markup language, so that the browsers render the content correctly. A Doctype declaration triggers standards mode in your browser and should always be used. Quirks mode should always be avoided. Doctype HTML is a declaration that tells the browser what version of HTML the document is written in. This declaration appears as the very first line in an HTML file. Here's an example of an HTML file with a doctype declaration: The DOCTYPE is not actually an element or HTML tag. It lets the browser know how the document should be interpreted, by indicating what version or standard of HTML (or other markup language) is being used. HTML5 Documents For HTML5 documents (which nearly all new web documents should be), the DOCTYPE declaration should be: The HTML !doctype tag is used for specifying which version of HTML the document is using. This is referred to as the document type declaration (DTD).. The HTML 4 document type declaration starts off with