In SGML and XML-based markup languages, a "tag" is a marker for beginning and end of an element.

A tag is a word, closed in angle brackets, like this: <tag>. There are two basic kinds of tags, start tags and end tags. Start tags are, as shown before, just word in brackets; End tags are just the same but also have slash as the first character: </tag>. Example of tagged text: <tag>Some text!</tag>

In SGML, end tags are sometimes not required at all, and end tags can be substituted with so-called short closing tag </>. For example: <tag>Some text!</>

(Note that most HTML parsers hate that!)

In XML, end tags are always required - except in case of end-tag-less, self-closing elements. Example of such: <tag />.

In addition to just being there, tags (AFAIK just start tags, of course) can have attributes. Example: <tag attribute="value">. In SGML, attribute values (depending on type) can sometimes be left unquoted; XML requires quotes.

What goes inside tags is an entirely different matter, defined in the <!element> declarations in DTD - and that, friends, is a story best left told another time...


Short for Target Aquisition Gear.