Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

The Shape of an HTML Document · Lesson 7 of 18

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>
<a> and </a> are tags. The whole thing together is an element. href="https://example.com" is an attribute.
🤖
Attributes are how a tag says "and here's a detail about me." 🏷️

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">
Three attributes on one tag: src, alt, and width.

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.

Quick check

In <a href="https://example.com">Click here</a>, what is href="https://example.com"?

Fill in the blank

A(n) ____ is a tag together with everything inside it, from the opening tag to the closing tag.

True or false

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 →