Search code examples
htmlterminology

What is the difference between HTML tags and elements?


I notice that most people use the words HTML tags and HTML elements interchangeably.

But what is the difference between them?

The way I see it is that tags are in the source code and elements are processed tags (by the browser) in the DOM. Am I wrong?


Solution

  • HTML tag is just opening or closing entity. For example:

    <p> and </p> are called HTML tags

    HTML element encompasses opening tag, closing tag, content (optional for content-less tags) Eg:

    <p>This is the content</p> : This complete thing is called a HTML element