Elements

An HTML element typically includes a start tag, some content, and an end tag.
These elements define the structure and display behavior of content on a webpage.

Basic Syntax

<tagname>Content goes here...</tagname>

Example Elements

<h1>My First Heading</h1>
<p>My first paragraph.</p>

Element Structure Breakdown

Start Tag Element Content End Tag
<h1> My First Heading </h1>
<p> My first paragraph. </p>
<br> None None

Nested HTML Elements

HTML elements can be nested — this means one element can contain another element.
In fact, every HTML document uses nested elements. It’s how the structure is defined.

Output :

Element Nesting Breakdown

Parent Element Nested Element Purpose
<html> <body> Holds the visible page content
<body> <h1> Defines the main heading
<body> <p> Defines a paragraph of text

Empty HTML Elements

In HTML, elements that have no content inside them are called empty elements.
These elements do not need a closing tag and are written using a single tag.

Example

<p>This is a paragraph.<br>This is a new line.</p>

Common Empty Elements

<br>     Line Break
<hr>     Horizontal Line
<img>    Image
<input>  Input Field
<meta>   Meta Information
<link>   External File Link

Empty Element Breakdown

Tag Description Closing Tag
<br> Line Break None
<hr> Horizontal Line None
<img> Image Tag None
<input> Form Input Field None

Output :