HTML Body

After discussing the HTML head, let's now move on to the HTML body.  The HTML body is where the main content of the website is contained. Let's look at an example of an HTML body below:

1<!DOCTYPE html>

2<html>

3<head>

4<title>My very first Website</title>

5</head>

6<body>

7<p>This is my very first website. </p>

8</body>

9</html>

––––––––

Remember when we said that an HTML file is divided into two parts, the head part and the body part? Notice how the head and the body elements are independent of each other. The HTML body falls outside of the head tag. Also, as you can clearly see from the example, the HTML body tag makes use of the <body> and </body> tags.

Novice HTML programmers usually make the mistake of putting the body element immediately below the title element in the head. This would be perfectly understand if you were writing a normal article. However, a body below a title element inside a head tag does not make an HTML body tag in HTML.

What you should do is open the body tag immediately after the closing head tag; as you can clearly see in our latest example. In between the body tags is where we would be nesting the contents of our website.  In our previous example, we can clearly see that we have a paragraph element nested inside our body tag.

A paragraph element is just one of many elements that can be nested with an HTML body. Paragraph elements are characterized by the opening <p> and closing </p> tags. And if you still haven't figured it out, opening tags are created by enclosing the tag name between a lesser than symbol “<” and a greater than symbol “>”.  Closing tags, on the other hand, are pretty much written in the same way except for the forward slash symbol “/” that you have to put immediately after the lesser than symbol “<”.

In our paragraph tag example, the opening paragraph tag is composed of the letter “p” enclosed between the greater than and the lesser than symbol “<>”. When it comes to the paragraph closing tag, the letter “p” is preceded by a forward slash symbol “/” while both are  still enclosed between the greater than and lesser than symbol.