Nearby lessons

2 of 24

📦 HTML Elements

🎯 What is an HTML Element?

An HTML element is made of a <start-tag>, some content, and an </end-tag>.

It tells the browser how to display content like text, images, links, and more.

<tagname>Content goes here</tagname>

Example: <p>Hello</p> is a paragraph element that shows "Hello" on the page.

🔤 Basic HTML Element Example

Every HTML page starts with basic elements like <html>, <head>, and <body>.

The <p> tag is used for paragraphs and is one of the most common elements.

Example02
🌐Code Cell
Loading Editor...
✏️ You can edit this code — click Run to refresh the preview.
Output

🚫 Empty HTML Elements

Some elements don’t need a closing tag or content. These are called empty elements.

They are self-closing and often used for layout and spacing.

Example: <br> adds a line break. <img> is used to display an image.

Example03
🌐Code Cell
Loading Editor...
✏️ You can edit this code — click Run to refresh the preview.
Output

📚 Nested HTML Elements

HTML elements can be nested, which means one element can be placed inside another.

This allows building a proper page structure like sections, headers, and containers.

Example: A <div> may contain a <h1> and <p> together.

Example04
🌐Code Cell
Loading Editor...
✏️ You can edit this code — click Run to refresh the preview.
Output

🧠 Test Your Knowledge

5 Questions
Progress: 0 / 5