Elements, Tags, and Attributes
A free lesson from Swipe Coding · HTML, level 1 · updated October 2026
By the Swipe team, founded by Colin · how we make lessons
Three terms get used constantly in HTML, and it's worth being precise about them. A tag is the actual markup, like <p> or </p>. An element is a tag together with its content — the opening tag, everything inside, and the closing tag. An attribute is extra information added inside an opening tag.
<a href="https://example.com">Click here</a>
An attribute always lives inside the opening tag, written as a name, an equals sign, and a value in quotes: name="value". A single tag can carry several attributes, separated by spaces.
<img src="cat.jpg" alt="A sleeping cat" width="300">
These words get used loosely in everyday conversation — people often say 'tag' when they mean 'element,' and that's fine informally. But knowing the precise difference will make documentation and error messages far easier to understand as this track goes on.
In <a href="https://example.com">Click here</a>, what is href="https://example.com"?
A(n) ____ is a tag together with everything inside it, from the opening tag to the closing tag.
A single tag can only ever have one attribute.
Keep your streak going in Swipe Coding
Swipe through every level of HTML on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.
Get the Swipe apps →