I mentioned that HTML, as a computer language, has a defined syntax. This syntax was not thought up at random, since the idea of a markup language is hardly new. A language called SGML, the Standard Generalized Markup Language, exists that is used to define markup languages. Make sure you get this right: SGML is a markup language whose sole use is to define other markup languages. And one of those many languages is HTML.

Now wait. Before you click on our sponsor's ad and get out of here, afraid that you'll have to learn another language, let me assure you that no such thing is needed. You do not need to know SGML to learn HTML. It's just useful to know that HTML is an application of SGML, which will explain a few things.

Now let's get down to business. Remember the heading we saw in the last section? If not, here it is again.
Acme Computer Corp.

We know this is a heading, but we need a way of encoding this in the document itself. To do this, we make this heading an element. We do this by writing the following (yes, this is HTML!):

Acme Computer Corp.



This element can be split into three parts. The first part,

is called the start-tag. Then comes the element's content, which in this case is the text "Acme Computer Corp.". Finally,

is the end-tag.

This element is an H1 element, which happens to mean that it is a level 1 heading (we'll get to that later). You need tags to indicate where the element starts and where it ends. Tags always start with a less-than symbol (<) and end with a greater-than symbol (>). A start tag has the element's name in between these symbols, (in this case, H1). An end-tag has a slash (/) followed by the element's name. Here are some more examples of elements:

I'm an element.


So am I!


Hey, me too! And me!


There's another element after me.





The perceptive amongst you may have noticed a few things in the above elements: first, the B element is inside a P element. This is fine; you can have elements inside other elements, as long as you have proper nesting. This means that if an element starts within another element, it must end within that same element, like this:

This is right


This is wrong



The second line above is incorrect because the B element starts inside the P element, but ends outside the P element.

The second curious thing you should have noticed is that the HR element has no content and no end-tag. This is also allowed, for some element types. The HR element in this case is called an empty element. Using only a start-tag is permitted in this case, but only for elements that are empty.

Now that you know what an element is and how to specify it in your document, it's time to learn about some of the elements in HTML and use them to make your first HTML document.