The screenshot below shows all of the necessary elements of an HTML5 page.
Use the line numbers in the image for reference.
<!DOCTYPE html>
This lines contain the Document Type Definition (DTD), also know as the doctype. The DTD tells the browser what type of markup language a page is using. The DTD is always the first thing in any HTML document.
The HTML5 doctype is very simple. Previous doctypes were much more complicated.
You can read more about DTDs at the w3schools page on HTML <!DOCTYPE>
Declaration.
<html lang="en">
This is the start of the <html>
tag. Everything in an HTML document (other than the DTD) is enclosed by the html tag.
The language part must always be included. 'en' stands for English and tells the browser the document is in English.
<head>
This is the start of the <head>
tag. The head section is where all of the "information" about the page is stored. Most of the elements included inside this section will not be visible in the browser.
<meta charset="utf-8" />
This is a <meta>
tag. There can be multiple meta elements which each include different types of information. This particular one specifies the character set of the document as utf-8. It's not important right now to know what all that means, just remember to put it there.
<title>Page Title</title>
These are the opening and closing <title>
tags. The text between the two tags, in this case "Page Title", is what will be the title of the page. The title is what will display in the browser tab label of your browser window.
</head>
This is the end of the head section. Note that this tag has a forward slash ( / ) in it. This indicates that it's a closing tag. Most HTML tags have an opening and closing tag.
<body>
This is the start of the <body>
tag. All of the content of your web page should go between the opening and closing body tags.
</body>
This is the closing <body>
tag.
</html>
This is the closing <html>
tag, signifying the end of the HTML document. It should be the last thing in the document. Notice the forward slash that indicates it's a closing tag.