Skip to content

Web development

HTML element nesting

Nested elements group a service heading and its description into a meaningful section.

Fatima copies a window-cleaning service to a client's new page, taking everything from <section> to </section>. The heading arrives, but the description doesn't:

<section><h1>Window Cleaning</h1></section><p>Clear glass, inside and out.</p>

How did the description get left behind?

Start the lesson

4 minutes. No sign-up needed.

What you'll learn4 ideas
  • A section is an element that groups content about one topic, like a service's heading and its description.
  • Nesting means putting a complete element between another element's opening and closing tags.
  • Each element inside a section has to finish before you close the section itself with </section>.
  • Indentation is the spaces before inner elements, which help people read the code, but the tags, not the spaces, do the nesting.
Chapter 1: Structuring web pages with HTML7 lessons · 27 min

This lesson is part of the Web development course.

Example plan3 lessons · 12 min

HTML elements4 min
HTML element nestingStructuring web pages with HTML4 min
HTML document structureStructuring web pages with HTML4 min

An example. Your plan follows your answers, so it can start later and end sooner.

Build my plan

Start free, no account needed.