HTML <!DOCTYPE>
Updated: 12/10/2023 by Computer Hope
When writing in HTML (hypertext markup language), the <!DOCTYPE> declaration lets an Internet browser know a page's HTML version or document type. This declaration is not only mandatory on every page; it must be the first thing you type.
Note
The <!DOCTYPE> must be the first line in your HTML file with no other charters or text in front. If anything is in front of this tag it causes some browsers to not display the page properly.
Doctype example
<!DOCTYPE html>
In the above example, the web page document type is defined as HTML. When designing a web page, this is the most common example of what would be used because most pages are written in HTML. A different type of document type could be an XML (extensible markup language) page.
Compatibility
Internet Explorer | Firefox | Safari | Opera | Chrome |
---|---|---|---|---|
All versions | All versions | All version | All versions | All versions |