Basic HTML Document Structure
All HTML documents must adhere to the same basic structure. There are some variations between the different versions of HTML, which are described below.
<!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Document Title</title> </head> <body> ...[page content]... </body> </html>
Differences Between HTML Versions
The Doctype Element
All HTML pages should have a
<doctype> declaration that informs the browser which version of HTML the page is written in. See doctype for more information, as well as a list of available doctypes.
The HTML Element
For HTML4 and HTML5 documents, this is simply
<html lang="en">. For more information, see Language Codes.
The Character Encoding Element
This is the
charset meta element. An HTML4 document doesn't have the trailing slash, whereas an HTML5 document may or may not have the trailing slash. It's preferable to put it before the