The HTML <!DOCTYPE> Tag / Document Type Declaration
The document type declaration (DTD), or doctype for short, states what type of document the page is and which standard it uses. Doctypes identify which version of HTML or XHTML you used to create the webpage. The parsing program (normally an internet browser) will then know the syntax of the document and is able to render the page properly. You use a different doctype for each different version of HTML. The rules differ subtly for each doctype.
<!DOCTYPE> declaration is not really an HTML tag, it is an instruction to the web browser about what version of HTML the page is written in. You use a different doctype for each different version of HTML. The doctype tag (
<!DOCTYPE … >) is the first tag on you HTML page. This tag is not self-closing (There is no forward slash -
/). The word "DOCTYPE" should always be in capital letters. What comes after the word DOCTYPE depends on the HTML standard your webpage was written in. Today's webpages should use the HTML5 doctype. This allows them to take advantage of the advanced features offered by HTML5. Here's what the HTML5 DTD looks like: