HTML Basics Part 9: HTML Main Elements

In this part of the HTML Basics series, I will talk about some of the main HTML elements that every web page needs to have.

Every HTML document (web page) consists of three main elements as shown in the below example. These HTML elements are html, head and body.

<html>
<head>...</head>
<body>...</body>
</html>

In this part, we will briefly explain the role of each element.

html

HTML documents are defined by the html element.

<html>...</html>

The page starts with the opening <html> tag and ends with closing </html> tag. All the other elements on the web page are contained within the html element.

If you right click on this page and select "View Page Source", you will notice that the first tag of this page is <html> (after doctype declaration), and the last tag is </html>. Do this on any web page and you will see the same thing.

head

The head of an HTML document is defined just after the opening <html> tag.

<head>...</head>

Head element may contain the title of the page, meta information about the page, scripts and styles. Please check the next part of this tutorial, HTML Head, for a more detailed explanation of head element.

body

Everything you see in your browser window is contained within the body element.

<body>...</body>

Text, links, images, videos, forms and all such web page elements are defined in the body of the HTML document.

Inside the body, you can define divisions (<div>), paragraphs (<p>), links (<a>), images (<img>) and other HTML elements. You can also insert scripts into the body.

In the next part, I will talk about head element in detail.

Was this post helpful?

If you found this post to be helpful, please share it! Thank you :)

f t g+ in