oblaat

a guide to conceiving, creating & publishing your own website

HTML page structure

Doctype declaration

A doctype declaration tells the browser what type of document it is looking at. In this case, it informs the browser that it is for sure looking at a HTML document. The computer can never be sure: maybe it is looking at any other document with similarly styled tags, such as an XML file? No! This document clearly tells you what it is: HTML.

The doctype delcaration is simple: <!DOCTYPE html>. This is the first thing that should appear in any HTML document.

The html element

Now, you need to tell the computer where the HTML actually is. In HTML, everything needs to be marked up, including the document itself.

This is done with the html tag, which from there contains the two vital parts of HTML documents: the head and the body.

The head element

If you are on the street and see somebody you recognise, you probably need to get a look at their face first to be sure of yourself. When you see all of their facial features—their eyes, nose, mouth, jaw shape, and so on—and combine it with their haircut and method of dress, this information together lets you be sure of who this person is.

The head element serves the exact same purpose. It tells your browser all the information it needs to know about the page. It is not shown to the human reading the Web page, but computers process it in different ways and store it however they would like.

The body element

Of course, that person you know's face is not the whole of them. In reality, that head of theirs is attached to their body: held up by two legs, two arms by their side, and many organs inside working away to keep them going.

The body element makes up the body of your document, too. This is the meat and potatoes: everything you want people to read, see, listen to or watch lies here. Most of your work will be done inside the body.

HTML documents do not have tails. Humans can't relate to that sort of business.