How to use HTML head and body elements



In our last article, we make mentioned about the HTML, head and body elements. So in this post, We will look deeply into how these elements works and when to use and how to use them when building website from scratch.

Now if you have been told that, making or creating website is hard. I can boldly tell you that, that true. If you put your head and learn it properly, creating website is not actually difficult.

So when you are set to start creating website. The first thing you need is code editor. There are a lot of them free to download on the internet. But if you using Windows operating system (OS) I prefer you start with notepad which comes with every Windows operating system.

Click on the system menu button, type in NOTEPAD in the search input field and notepad will pop up, then click to open it.

Now we have our notepad running. When you want to start writing html codes, the first thing to do is to declare the document type. Declaring the document type tells the browser or interpreter the version of html you are writing.

For the purpose of this article, we will be dealing with html 5, the newest version of html.

The small piece is code showing below is the code for html 5 document declaration.

example;  <! DOCTYPE>

With above small code, you are telling the interpreter that, you are writing HTML 5 document.

The document declaration must be at the top of the page before any other code.

Now the second thing is the opening and closing syntax of HTML. The HTML syntax stand as the four wall of the website.

Example;  <HTML> every other code goes in here </HTML>

Now in between four walls, we head and body elements.

Example;

<! DOCTYPE>

<html>

<head>

In between the head syntax is where all styling and search engines codes will go in

</head>

</html>

Lastly, we need to add up the body syntax that will contain all those information you it to appear on the page or pages.

Example;

<! DOCTYPE>

<html>

<head>

In between the head syntax is where all styling and search engines codes will go in

</head>

<body>

this is where the codes of image, video text will go in

</body>

</html>

So this will be the end of this post. In our next post, we will look into adding heading and paragraphs in between our body syntax.

Comments

Popular posts from this blog

What is HTML and how can one use it?