You need to know more than how HTML tags work. There’s a structure that HTML documents should follow.

Now that you know how HTML tags work from the previous episode, you can use that to create your own HTML pages. This episode will describe what makes an HTML file and also give you some history of HTML that you’ll need in order to understand how these tags can change.

You start out an HTML file with a doctype declaration and this is followed with the html tag. The html tag forms the root of your document and surrounds everything else.
You’ll find two main tags inside the html tag and these are head and body tags.

Let’s start with the doctype. This is the first line in an HTML document. It’s purpose is to let the browser know that this really is an HTML document. And for HTML 4, it also lets the browser know how to handle older HTML files.

The next tag is html. You can actually leave this out in HTML 5 but I don’t know why you’d want to do that. Just go ahead and include a single html begin tag right after the doctype and make sure to put the ending html tag at the end of your document.

The head tag goes inside the html tag and before the body tag. This is where you can specify things about the document itself such as the title.

And finally, the body tag is what defines everything that the browser displays on the web page.


What's on your mind?

On a scale of 0 to 10, how likely are you to refer us to a friend?