HTML <!DOCTYPE>
- Previous Page HTML Web Servers
- Next Page HTML Quick Reference Guide
!DOCTYPE declaration helps the browser display web pages correctly.
!DOCTYPE Declaration
There are many different documents in the Web world. Only by understanding the type of the document can the browser display the document correctly.
HTML also has multiple different versions. Only by understanding the exact HTML version used in the page can the browser display the HTML page correctly. This is the purpose of <!DOCTYPE>.
<!DOCTYPE> is not an HTML tag. It provides information (a declaration) to the browser about which version of HTML the document is written in.
Tip:CodeW3C.com is about to upgrade to the latest HTML5 document type.
Example
HTML documents with HTML5 DOCTYPE:
<!DOCTYPE html> <html> <head> <title>Title of the document</title> </head> <body> The content of the document...... </body> </html>
HTML Versions
From the early days of the Web to the present, multiple HTML versions have been developed:
Version | Year |
---|---|
HTML | 1991 |
HTML+ | 1993 |
HTML 2.0 | 1995 |
HTML 3.2 | 1997 |
HTML 4.01 | 1999 |
XHTML 1.0 | 2000 |
HTML5 | 2012 |
XHTML5 | 2013 |
Common Declarations
HTML5
<!DOCTYPE html>
HTML 4.01
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
XHTML 1.0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
For a complete list of document type declarations, please visit our DOCTYPE Reference Manual.
- Previous Page HTML Web Servers
- Next Page HTML Quick Reference Guide