The <!DOCTYPE> declaration is to tell the browser what version of HTML the page is written in.
(other versions include HTML4, XHTML 1 etc ). The browser uses this declaration to determine the best way to render the web page.
Here is the HTML5 doctype declaration.
<!DOCTYPE html>
A Simple HTML5 template with doctype
<!doctype html> <html> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <title></title> <meta name="description" content=""> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <h1>Your Heading</h1> <p>Your Content</p> </body> </html>
Browser Compatibility
This HTML5 doctype declaration is compatible with all browsers in use today. The browser will display the web page in “standards mode”
Compatibility chart:
Mozilla,Safari Opera 10, IE10, all modern browsers |
Opera 9.0 | IE 8, IE 9 & Opera 9.5 | IE 7 & Opera 7.10 | IE 6 & Opera 7.0 | Mac IE 5 |
---|---|---|---|---|---|
S | S | S | A | A | A |
S: Standards Mode
A: Almost Standards Mode