All HTML documents have a required structure that includes the following declaration and tags:
doctype
, html
, head
, and body
.
The
doctype
declaration is used to instruct web browsers which version of HTML is being used and is placed at the very beginning of the HTML document. Following the doctype
declaration, html
tags signify the beginning and end of the document.
The
head
of the document is used to outline any meta data, the document title
, and links to any external files. Any context included within the head
tags is not visible within the actual web page itself. All of the content visible within the web page will fall within the body
tags.
A general HTML document structure looks like the following:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Hello World</title>
</head>
<body>
<h1>Hello World</h1>
<p>This is a website.</p>
</body>
</html>