Jens Oliver Meiert

Elements, Tags, and Attributes

Published on Sep 24, 2006 (updated Jun 1, 2021), filed under , . (Share this on Mastodon or Bluesky?)

“Tag” is a frequently used term in web development when it comes to HTML/XHTML elements. Unfortunately, it’s not only used incorrectly by outsiders and beginners. The term “tag” is often used to refer not just to tags, but also to elements or even attributes, which is incorrect. This article explains the correct terminology and builds on a series of publications that focus on professional language usage.

Those who understand “tags” to mean labels, categories, and the like will be more interested in additional information about “social tagging” or taxonomies.

What Are Elements, Tags, and Attributes?

“A picture is worth a thousand words,” reloaded:

<foo bar="baz">Text</foo>

The example shows a foo element, specifically <foo bar="baz">Text</foo>. It consists of an opening foo tag (“start tag”), i.e., <foo> or—completely—<foo bar="baz">, the element content “Text,” and a closing foo tag (“end tag”), namely </foo>. Additionally, the foo element or its start tag has a bar attribute with the attribute value baz.

Put differently:

<elementname attribute="value">Element content</elementname>

And using a concrete example:

<abbr title="Periodic Table of Elements">PTE</abbr>

This shows an abbr element that represents the abbreviation “PTE” for “Periodic Table of Elements.” While “PTE” represents the element content, the spelled-out form is given as the value of the title attribute. The title attribute is defined in the abbr start tag, since attributes have no place in end tags.

Is There a Shortcut?

Yes: In 90% of cases, most people mean elements when they talk about tags; in 5% of cases they mean attributes, which is even “more wrong”; and in 5% of cases they actually mean tags. Get into the habit of talking about “elements” instead. If you also call attributes “attributes,” you’ll quickly know when tags are really what’s meant.

But Doesn’t “Tags” Sound Cooler?

No. In case the above explanation doesn’t provide enough motivation to use professional terminology, or if “tags” simply sounds nicer to some: Constant, unreflective talking of “tags” is incorrect.

Does Anyone Else Talk This Way?

Yes:

About Me

Jens Oliver Meiert, on November 9, 2024.

I’m Jens (long: Jens Oliver Meiert), and I’m a web developer, manager, and author. I’ve been working as a technical lead and engineering manager for companies you’ve never heard of and companies you use every day, I’m an occasional contributor to web standards (like HTML, CSS, WCAG), and I write and review books for O’Reilly and Frontend Dogma.

I love trying things, not only in web development and engineering management, but also in other areas like philosophy. Here on meiert.com I share some of my experiences and views. (I value you being critical, interpreting charitably, and giving feedback.)