Learning HTML 3.2 by Examples, section 3 General remarks on the syntax of HTML:

HTML elements

Most, but not all, HTML tags are paired so that that an opening tag is followed by the corresponding closing tag, and there can be text or tags between them, as in

In such cases the two tags and the part of the document enclosed by them forms a unit which is called HTML element.

The opening tag, or start tag, is a tag without the / character, since the presence of that character after the opening < indicates a tag as a closing tag, or end tag.

Some tags, e.g. <HR>, are HTML elements by themselves, and for them the corresponding end tag would be illegal. - In the sequel we will usually refer to tags by their name only, omitting the obligatory angle brackets.

For some elements which logically consist of a start tag, some content and an end tag, it is legal to omit the end tag, possibly even the start tag. For example, you can omit the end tag </P> and let browsers and other software imply it when necessary. The exact rules for allowable tag omission are given in the HTML specification, often only in the formal (SGML) syntax, so they can be hard to read. Moreover, some browsers are known to misbehave if you omit some end tags even when the specs allow it, and this can have drastic effects e.g. when nested tables are involved. Thus it is wisest to use explicit end tags always for all elements which logically have an end tag.

Date of last update: 2010-12-16.
This page belongs to the free information site IT and communication, section Web authoring and surfing, by Jukka "Yucca" Korpela.