Basic HTML

Which HTML Tags Are Required?

There are two very basic, essential HTML tags that every HTML file should contain. Let’s say you wanted to describe a cat using HTML tags. What would the essential parts be?

A very simple description would include a cat’s head and its body. Obviously a cat has other parts too, like ears, eyes and a mouth but you could say they are a part of the head. Legs, a tail and claws would all be parts of the body.

To write this as HTML tags you would need to include the opening part and the closing part for each tag and write what the element is, either head or body, into each.

This simplistic description of cat could be written in HTML as:

        <head> </head>
        <body> </body>
      

Body In The Box. Head Out Of The Box

Even though we were describing a cat, these two HTML tags are actually valid, real, essential HTML tags which will be part of the code for every HTML file you create! There you have it, your first proper HTML code.

So that code I wrote is actually real computer code?

Yes, it is perfectly valid and any computer could read it which is just what we want.

But what will it look like?

Well, actually it will be blank. The code works but it is for an empty page.

The first line is the head tag and is used to set up your file, like when you write the date and subject or title of a lesson in your school book. When we look at CSS, we will go into more detail about what the head tag is properly used for.

You could save a HTML file with those two HTML tags in, upload it to a server and it would work as a website because the code is right. Any computer would be able to read it correctly, but all you would see is a blank page.

That is because, it is inside the body tag of your HTML file that all the useful stuff, like text, images and buttons, are kept and at the moment the body is empty so there is nothing to show.

But I don’t want to make a blank website.

The world needs to know about the best places to doze!

We are getting there. It is blank because the body is empty. Do you understand?

I know all about empty bodies.

Like right now my body is pretty empty, specifically my tummy.

I know your body's empty. I've seen what you left in the litter tray.

With the head and body tags in place, you can now begin to add interesting stuff, known as content, to your web page by adding other HTML tags inside the body tag.