agyanadda@gmail.com

HTML Elements

HTML Basics 1 min read Updated Nov 30, 2026 Topic 5 of 33

Examples

Example — Nested elements HTML
<div>
  <h2>My favourite fruits</h2>
  <ul>
    <li>Mango</li>
    <li>Banana</li>
  </ul>
  <p>Elements can be <strong>nested</strong> inside other elements.</p>
</div>
Example — Empty elements HTML
<p>Line one<br>Line two (br has no closing tag)</p>
<hr>
<img src="https://www.w3schools.com/html/pic_trulli.jpg" alt="Houses" width="180">

br, hr and img are empty elements: they have no content and no closing tag.

Try it Now »

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which is an empty element (no closing tag)?

Exercise 2 True / False

Elements must be closed in the reverse order they were opened.

Exercise 3 Fill in the Blank

An element = start tag + content + ___ tag.

Frequently Asked Questions

Browsers often guess and still show the page, but the layout can break. Always close your tags.