Dremendo Tag Line

Mastering HTML Structure: Doctype, HTML, Head, and Body

About HTML

In this lesson, we will learn the 4 essential parts of an HTML document, including doctype, html, head, and body. Build a solid foundation for your website with this guide.

Basic HTML Document Structure

The basic structure of an HTML document consists of these four parts: the doctype declaration, the html tag, the head tag, and the body tag. See the example given below.

Example

<!doctype html>
<html>

<head>
	<meta charset="utf-8">
	<title>Page Title</title>
</head>

<body>

</body>

</html>

The above code is an example of a basic HTML document structure. Let's discuss the above html code in detail.

  • <!doctype html>: The doctype declaration tells the browser which version of HTML the document is written in. In the above example, the html version is 5. So it is written as <!doctype html>.
  • html Tag: The html tag is the container for the entire HTML document. It tells the browser that the document is written in HTML. The html tag consists of the opening tag <html> and the closing tag </html>.
  • head Tag: The head tag is located within the html tags and it contains information about the document, such as the title of the page, links to stylesheets and scripts, and metadata (<meta> tag). We will learn about the <meta> tag later in our HTML tutorial. The <title> tag within the <head> tag contains the title of the html document, which is shown in the browser tab.
  • body Tag: The body tag contains the visible content of the document, such as text, images, videos, and other multimedia elements. It is located within the html tags just after the closing </head> tag.
video-poster