HTML Essentials

Elements

Build pages from nested HTML elements.

Elements form a tree. A child element sits inside a parent element, and siblings share the same parent.

Important definitions

Parent
An element containing another element.
Child
An element nested directly inside another.

Syntax

Use this general pattern as a reference:

HTML
<tag>content</tag>

Examples

Nested elements

EXAMPLE 1
<article><h2>News</h2><p>Today update.</p></article>
ResultA News article
Try it yourself

Expected output

A heading and paragraph grouped as an article.

Note

Indentation does not change meaning, but improves readability.

Tip

Indent nested elements consistently.

Common mistakes

  • Overlapping tags.
  • Leaving required closing tags out.