What Is the Difference Between a Tag and an Element?

<address category = "residence">
    <name>name content</name>
    <company>company content</company>
    <phone>(011) 123-4567</phone>
</address>

Here <address> is an element which has attribute category

Start and end tags of an element must be identical.


HTML elements are defined by a starting tag, may contain some content and a closing tag whereas Tags are the starting and ending parts of an HTML element.

enter image description here


Tags mark the start and end of an element.

  • <foo> — start tag
  • </foo> — end tag
  • <foo></foo> — element

See the specification:

Each XML document contains one or more elements, the boundaries of which are either delimited by start-tags and end-tags, or, for empty elements, by an empty-element tag.


See also section 5 of NOT the comp.text.sgml FAQ