An HTML document defines the structure of HTML web page. It contains two distinct parts, the head, and the body. The head contains information about the document. The body part contains the content of the document, which gets displayed.

Just keep in mind that you should use the head part inside <head>…</head> tags. The body tag is used inside the <body>…</body> tags. Also, an HTML document begins with the <!DOCTYPE html> declaration, which is known as the DTD (Document Type Definition). This is to inform the web browser the type and version of the HTML document.

create HTML document



Example
You can try to run the following code to create an HTML document. The <p> tag defines the paragraph −
<!DOCTYPE html>
<html>
<head>
<title>HTML Document</title>
</head>

<body>
<p>The content gets added here.</p>
</body>
</html>