02Geek HTML5 and JavaScript, TypeScript, React, Flash, ActionScript online School
Previous VideoNext Video

HTML, HEAD and BODY Tags

In this video, we explore the essential tags required for every HTML page: HTML, HEAD, and BODY. Learn the purpose of the HEAD area for background tasks (like setting the page title, keywords, and metadata) and the BODY area for displaying visible content. Understand the importance of structuring your HTML properly to ensure pages render as expected.

Video Transcript

00:00Every HTML page has a few tags that you have to have in the page
00:03Without them it's not really a page.
00:05We are going to look at that 'p' tag again in the future
00:08but look at those basic tags that every page needs to have
00:15The first basic tag is 'html' - which makes sense
00:20We tell our browser that everything from the start here,
00:23all the way to the end of it is all HTML
00:27-Okay.
00:27-That's logical. - Okay.
00:29Every HTML has two sections.
00:31It has invisible section that's behind the scenes,
00:34which in programming is called 'the head area'
00:38and you have the 'body area'
00:39The head area is in control of all the things you don't see
00:42or you see in the header of the page
00:45such as 'the head'
00:48and the head has opens and closes
00:51so that's the head itself
00:54-What does that mean that it's not seen?
00:57-Well, there's some stuff that are not a part of the page itself
00:59but we still need to tell it to the computer
01:02such as: what is the font that we're going to use,
01:06what are the colors that are going to be all over the page
01:09a little bit of code that's gonna be in the background
01:11the title of the page
01:12maybe 'keywords' so search engines could find our page
01:16but it's stuff that we don't want people to see
01:18on the page itself
01:19-Okay,
01:19So anything that doesn't go into the page,
01:21most of the time goes into the 'head' area
01:24It's not a good name if you are new to this
01:27If I would have to name it I would say: the background
01:31or external information or anything that is not part
01:36of the body
01:37So it's not body
01:40-Okay, alright
01:40And then we have a body area itself
01:42The body itself contains everything that is visual
01:47So anything that goes into the page goes into the body
01:50-I'm going to ask you question now.
01:57-Let me ask you two questions.
01:59-If I render the page what you think we're going to see on the page?
02:02-I'll see the body.
02:03-And what is going to be in the body ?
02:08-headlines, paragraphs.
02:11Let's see what happens and then you tell me why...
02:14before you saw: 'things this great'
02:20Now we see nothing.
02:22We just typed quite a lot and we see nothing
02:24so when you look at the code could you explain to me
02:26why do you think nothing is there now?
02:31-Because we didn't put anything in the body.
02:34-Bingo!
02:35So all this is just like a background information for the browser
02:38to know what to put inside
02:38But because we didn't put anything in the body itself
02:41we can't see anything.

Ready to Level Up Your Skills?

Join thousands of learners on 02GEEK and start your journey to becoming a coding expert today!

Enroll Now for Free!

Lesson notes

In this tutorial, we’ll break down the essential tags every HTML page must include: HTML, HEAD, and BODY. Understanding these tags is the foundation of building well-structured web pages.


1. The HTML Tag

The <html> tag is the foundation of every HTML page. It wraps all the content on your webpage, letting the browser know that everything inside is HTML code.

Here’s how it looks:

<html>
  <!-- Content goes here -->
</html>

2. The HEAD Area

The <head> tag is for background or invisible tasks. It includes metadata and instructions for the browser that don’t appear directly on the webpage.

Common elements inside the <head> tag include:

  • Page Title: The text displayed in the browser tab.
  • Metadata: Information like keywords, description, or author details for search engines.
  • Links to Stylesheets or Scripts: External CSS or JavaScript files.

Example:

<head>
  <title>My First HTML Page</title>
</head>

Why It’s Important: The HEAD area is like the brain of your page. It manages settings and information needed for the page to work properly.


3. The BODY Area

The <body> tag contains everything visible on the webpage. Headlines, paragraphs, images, videos, and other elements go inside the BODY area.

Example:

<body>
  <h1>Welcome to My Page</h1>
  <p>This is a paragraph of text.</p>
</body>

Key Difference:
Content in the BODY tag is visible to users, while content in the HEAD tag works behind the scenes.


4. Putting It All Together

A complete HTML page with all essential tags looks like this:

<html>
  <head>
    <title>My First HTML Page</title>
  </head>
  <body>
    <h1>Welcome to My Page</h1>
    <p>This is my first paragraph.</p>
  </body>
</html>

5. What Happens If the BODY Is Empty?

If you don’t put any content inside the <body> tag, your webpage will appear blank. For example:

<html>
  <head>
    <title>Empty Page</title>
  </head>
  <body>
    <!-- No content here -->
  </body>
</html>

When viewed in a browser, this page will display nothing but the title in the browser tab.


Summary

By the end of this tutorial, you’ve learned:

  1. The HTML tag wraps all content on a page.
  2. The HEAD tag contains metadata and invisible elements.
  3. The BODY tag displays the visible content of your webpage.

What’s Next?

In the next tutorial, we’ll dive deeper into structuring your HTML content with more tags, like headlines and paragraphs.