HTML doctype tag is used to specify the type of the document. This tag must include the before <html> tag to show document type declaration.
Test it Live
1 2 3 4 5 6 7 8 9 |
<!DOCTYPE html> <html> <head> <title>This is document title</title> </head> <body> This is the document content. </body> </html> |
Output
The <!DOCTYPE>
tag does not contain any content and does not have any closing tag. The HTML doctype declaration confirms to the browsers that the document should be rendered as HTML.
Tip: Always consider adding a declaration to HTML documents to help the browser recognize the document type.
The syntax of the HTML !DOCTYPE tag in HTML 5 is given below:
Syntax
<!DOCTYPE html>
The above syntax shows that is HTML 5 document and should be executed as HTML. It has no closing tag in the HTML document. HTML 5 document declaration is standard and simple with this tag.
Note: DOCTYPE declaration is not case sensitive.
Specifications of HTML <!DOCTYPE> Tag:
Start Tag | <!DOCTYPE> |
---|---|
End Tag | N/A |
Content | N/A |
Supported Browsers
- Google Chrome
- Microsoft Edge
- Internet Explorer
- Safari
- Firefox
- Opera