Module 11: Introduction to HTML

Lesson 4 of 5 · 15–25 minutes

Elements and attributes

🏠The everyday picture

A parcel with a label: the parcel is the thing, and the label adds details about it ("fragile", "deliver to flat 4B"). In HTML, the element is the parcel and attributes are its labels.

📘What it really is

🖱️Try it

Give your first paragraph class="intro". Add a comment above your <h2> sections explaining what they are. Then deliberately break the nesting (swap two closing tags), save, and right-click → Inspect in the browser. Notice how the browser guesses and repairs it. Fix it again.

✅Quick check

In <a href="contact.html">Contact us</a>, what's the element, the attribute and the content?

Show the answer

The element is a (a link), the attribute is href="contact.html", and the content is "Contact us".

Why is <p>Hi <em>there</p></em> a problem?

Show the answer

The elements close in the wrong order. Browsers guess how to fix it, and different guesses cause odd bugs.

← PreviousText and headings
ProLearners Assist