Home > Article > Web Front-end >
Definition and usage
All browsers support the declaration.
Thedeclaration must be the first line of the HTML document, before the tag .
Thedeclaration is not an HTML tag; it is a instruction that instructs the web browser as to which version of HTML the page should be written in.
In HTML 4.01, the declaration references a DTD, because HTML 4.01 is based on SGML(Standard Generalized Markup Language). DTD (document type definition) specifies the rules of a markup language so that browsers can render content correctly.
HTML5 is not based on SGML, so there is no need to reference a DTD.
Tip: Always add the declaration to your HTML document so the browser knows the document type.
There are three types of declarations (Strict, Transitional, Frameset) in HTML 4.01. In HTML5 there is only one:
<!DOCTYPE html>