In common usage, the terms ?HTML element? and ?HTML tag? are used interchangeably. A tag is an element is a tag.
But according to the W3C HTML specification, an element is the basic building block of HTML and is typically made up of two tags: an opening tag and a closing tag.
For example, the paragraph element <p></p> is made up of the opening tag <p> and the closing tag </p>. The element is the collection of both the starting tag and the ending tag.
In other words, the element is the entire HTML block that creates a paragraph. And the tags are the two pieces of the element?the opening piece and the closing piece.
Most HTML elements have an opening tag and a closing tag. These tags surround the text that will display on the web page. For example, the paragraph tag has an opening tag: <p>and a closing tag: </p>. To write a paragraph of text, you write the text to display on the page and then surround it with these tags:
This is a paragraph that will display on the web page. It is surrounded by opening and closing paragraph tags.
Some HTML elements do not have a closing tag. These are called ?singleton? or ?void? elements. Void elements are easy to use because you only have to include one tag in your web page. For example, to add a line break to your page you would use the BR tag:
Void elements have only one tag as part of the element, but in XHTML, you would also include a trailing slash in the beginning tag to show that it is a void element. For example, in XHTML to add a line break you would use the BR element with a closing slash:
In general, when I refer to an HTML element or tag, I will use the term ?element? to indicate that I am referring to all parts of the element (both opening and closing tags). But I may use the term tag to mean the same thing?an HTML item that will define something on your web page.