The Structure of an HTML Document

Here is the basic structure of every HTML document:

<!DOCTYPE  html>

<html>

<head>

<title> The page title goes here</title>

</head>

<body>

<h1> The first heading goes here </h1>

<p> A paragraph goes here.</p>

<p> Here is another paragraph. </p>

</body>

</html>

Every html file begins with the tag <!DOCTYPE html> indicating you are coding with the latest version of html – HTML5

Next is the <html> opening tag indicating that this is an html file. The whole document is coded within the <html> opening and </html> closing tag.

An html file consists of two parts, the head and the body.

THE HEAD: this is where the title of the document lives. A description of the file also lives within a <meta></meta> tag within the head section to enable search engines find this file on the web. You can also include your CSS and JavaScript codes in the head section of the document.

The title of your document appears in the title bar at the top of your  browser window when your document is displayed in a browser.

Here is how to create and view your HTML document.

THE BODY: the main content of your webpage is found in the body section. This includes headings at different sections of your webpage eg  <h1>, <h2>, <h3>, <h4>, <h5> <h6>. You will learn more about this in HTML tutorial.

Paragraphs live in <p> tags. Every paragraph lives in a separate paragraph tag and your page can have any number of paragraphs.

Other content that live in the body section are:

  • Images
  • Forms
  • Tables
  • Videos
  • Audio

..and more.

You will learn how to add each type of content in HTML tutorial. Notice that most elements have opening and closing tags. But some have just open tag and are called empty element. You will learn the difference in HTML tutorial.

Leave a comment

Design a site like this with WordPress.com
Get started