Elements, Attributes, Opening, Closing & Self Closing Tags


Opening Tag

In HTML, any tag starting with <> is called as an opening tag.
For example, <p> can be called as an opening paragraph tag.

Closing Tag

Any tag that looks like </> is a closing tag.
For example, </p> can be called a closing paragraph tag.

Self-Closing Tag

Any tag that looks like < /> is a self-closing tag.
For example, <img src=”” alt=”” /> is a self-closing image tag.

Attributes

Consider the below tag –

<img src="./image.jpeg" alt="Some Text" />

Here src and alt are the attributes that hold some value.

Elements

Any tag along with it’s content is called an HTML element.
For example,
<p>Some Text Here</p>
This is an element, as it has an opening tag, contents, and a closing tag.
It is also important to be noted that self-closing tags are an element in itself.