What Is the Difference Between a Tag and an Element?

Viewed 16472

In some texts about XML, the terms tag and element seem to be used interchangeably. Do they mean the same thing, or are do these terms represent different things?

3 Answers

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

<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.

Related