freecoding.school100% FREE · NO SIGNUP
Markup CityISSUE #5 of 39

elements · the building bricks

Tagg the BuilderVSThe Unclosed Tag
Tagg the Builder saysAn element is a tag pair wrapping content: an opening tag, the content, and a matching closing tag.

The element is HTML's basic unit. Most look like <p>text</p> — an opening tag, content, and a closing tag with a slash. The browser treats everything between as belonging to that element.

A few elements are empty (void) — they have no content and no closing tag, like <br> and <img>. Elements nest inside each other to build the tree, so always close the inner one before the outer.

Power-ups you unlock

The Unclosed Tag attacks — common mistakes

Boss battleNest a <strong> inside a <p>, then deliberately overlap them and watch how the browser silently "fixes" your tree in DevTools.

Example code

<!doctype html>
<html><head><meta charset="utf-8"></head>
<body>
  <p>A paragraph <strong>with a nested strong element</strong> inside.</p>
  <hr>
  <p>An <code>&lt;hr&gt;</code> above is a void element — no closing tag.</p>
</body></html>
▶ Open the interactive comic issue
‹ The Smallest Valid PageAttributes · Adding Instructions ›