Tags are the code representation of elements.
In XML, all elements require a start and end tag. Start tags are formed by an angular opening bracket (<), immediately followed by the element name, then optionally by whitespace and one or more attributes, and finally closed by a closing angular bracket (>). The end tag is comparable to the opening tag, but has a forward slash (/) between the opening bracket and the element name, and omits the attributes. An example of a start (beginning) and end (closing) tag pair:
The start and end tags can be collapsed into a shorthand notation if they have no content. The shorthand notation is identical to the start tag, except for a forward slash just before the closing bracket. Example:
<img src="example.gif"></img> is identical to <img src="example.gif" />
In HTML, a closing tag is required for most elements such as the
<div> element. However, some elements such as the
<img> element, and the
<link> element do not require a closing (ending) tag.