Definition of HTML "tag"
A tag in HTML is a representation of an element in the serialized form of an HTML document. A start tag or empty tag contains a <
, the element name, one or more optional attribute name/value pairs separated from the tag name and other attributes by whitespace and ends with either >
or />
, such as <br/>
, which is the line break tag in HTML. An end tag contains just </
, the tag name and >
, for example </html>
which is the </html> end tag.
The term tag is normally used when referring to the mark up in the serialized form of an HTML document. In contrast, the term element typically refers to the internal representation of an HTML object as a node in the document's hierarchical object model, encompassing all of its descendants.
A standalone tag is single tag that starts with the <
delimiter and is self-closed with />
. A standalone tag has no inner HTML content, not even HTML comments.
In an HTML document's serialized form, the name of a tag can be easily recognized because it will always be preceded by a left angle brace ("<
"), if it's a start tag or a standalone tag, or the by the characters "</" if it's an end tag. On this site, an element name with these characters indicates that the serial representation of the element is being discussed. An element name without these delimiters indicates that the internal representation of the element in the internal object model is being discussed.