<?xml version="1.0" encoding="utf-8"?>

Nested HTML element

Nested HTML element Bad Practice
Nested HTML element Best Practice

Just like a Russian nesting doll, some HTML elements can contain other elements, and we describe them as being "nested." In the correct example, the <div> element, which defines a division or a section in an HTML document, contains the <p> element — the paragraph in the text. Make sure to place the nesting elements between the start and end tags of a "parent."

There can be multiple nesting levels, and the relationship between elements and their parent and child elements creates a hierarchy. It's essential to understand this relationship because descendent elements usually inherit behavior and styling from their parent element.

Improve your UX & Product skills with interactive courses that actually work