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.

Code Example
PREVIEW READY
Loading Editor...
Live Preview

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

Code Example
PREVIEW READY
Loading Editor...
Live Preview

πŸ“š 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.

Code Example
PREVIEW READY
Loading Editor...
Live Preview

🧠 Test Your Knowledge

5 Questions

Progress: 0 / 5
Keep Going!HTML Attributes