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?
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.