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
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.
let's get down to business. Remember the heading we saw in the last
section? If not, here it is again.
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!):
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.
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:
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:
second line above is incorrect because the B element starts inside
the P element, but ends outside the P element.
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.