Introduction
Nested elements help organize content inside other content, like putting boxes inside bigger boxes. This makes your webpage structured and easy to understand.
Nested elements help organize content inside other content, like putting boxes inside bigger boxes. This makes your webpage structured and easy to understand.
<parent-element> <child-element> <!-- content or more nested elements --> </child-element> </parent-element>
<section> <h1>Title</h1> <p>This is a paragraph inside a section.</p> </section>
<ul> <li>Item 1 <ul> <li>Subitem 1a</li> <li>Subitem 1b</li> </ul> </li> <li>Item 2</li> </ul>
<nav> <ul> <li><a href="#home">Home</a></li> <li><a href="#about">About</a></li> </ul> </nav>
This webpage shows a section with a heading and a list of fruits. The list has a nested list inside the Banana item to show types of bananas.
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Nested Elements Example</title> </head> <body> <main> <section> <h2>My Favorite Fruits</h2> <ul> <li>Apple</li> <li>Banana <ul> <li>Yellow Banana</li> <li>Green Banana</li> </ul> </li> <li>Cherry</li> </ul> </section> </main> </body> </html>
nested elements in HTML?Text
follows correct order: <div> <p> Text </p> </div>. Others have mismatched or missing closing tags.<div>Hello <strong>World</strong>!</div>
<ul> <li>Item 1 <li>Item 2</li> </ul>
Pass the test and this pattern moves unknown