HTML Doctype tag is used to specify the version of the html using.
This tag must include before html tag to show Document Type Declaration. Tag tag does not contain any content and does not have any closing tag.
Syntax
1 |
<!DOCTYPE> |
1 2 3 4 5 6 7 8 9 |
<!DOCTYPE html> <html> <head> <title>Doctype tag example</title> </head> <body> This is the body content. </body> </html> |
Output
HTML Doctype html4 declaration
This is the example for Doctype HTML 4 declaration.
1 2 3 4 5 6 7 8 9 |
<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”> <html> <head> <title>Doctype tag example</title> </head> <body> This is the body content. </body> </html> |
Output
List of different doctypes
Sr. No. | doctype version | Declaration |
---|---|---|
1 | HTML 5 | <!DOCTYPE html> |
2 | HTML 4.01 Strict | <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01//EN” “http://www.w3.org/TR/html4/strict.dtd”> |
3 | HTML 4.01 Transitional | <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd”> |
4 | HTML 4.01 Frameset | <!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Frameset//EN” “http://www.w3.org/TR/html4/frameset.dtd”> |
5 | XHTML 1.0 Strict | <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”> |
6 | XHTML 1.0 Transitional | <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”> |
7 | XHTML 1.0 Frameset | <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Frameset//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd”> |
8 | XHTML 1.1 | <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.1//EN” “http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd”> |
Resources and References
1. W3C Specification.
2. HTML living standard
3. W3C project using Github