My colleague wanted to update the content of a
h1 element of page he was working on and started saying: “I need to update the content of this
h1 tag”. I immediately cringed.
HTML tag is probably the most common misconceptions I hear from people around me, and the misconception is quite widespread. Most of the time when people speak to me about tag, they mean element and they don’t understand the distinction between tag and element.
The HTML 4.01 specification has a section on elements with a very clear definition of elements:
Each element type declaration generally describes three parts: a start tag, content, and an end tag. This means
<h1>hello</h1> is a HTML element with
<h1> as the start tag,
hello as the content and
</h1> as the end tag.
What is more confusing is that HTML elements that have no end tag like the
br element whose role is only to terminate a line of text are HTML elements. HTML elements that allows author to omit end tag like the
p element are HTML elements. HTML elements that allows author to omit the tags entirely like the
body element are HTML elements.
Though I’m frustrated by the lack of care in the web development community in the distinction of the use of tags and elements, I am clueless as to why this is happening. I can only hope that my explanation can help increase the exposure of the subject.