HTML ELEMENTS

HTML (Hypertext Markup Language) elements are the building blocks of web pages. They are used to structure content on the web and provide meaning to different parts of a document. HTML elements are composed of tags, attributes, and content.

What is an HTML Element?

An HTML element is a complete set that consists of a start tag (or opening tag), content, and an end tag (or closing tag).

HTML Element = Start Tag + Content + End Tag

For example:

app/page.tsx
1<h1>This is h1 tag</h1>

In this example, <h1> is the start tag, "This is our first heading" is the content, and </h1> is the end tag. Together, they form an HTML element.

What is a Nested HTML Element?

A nested HTML element is an HTML structure where one element is placed inside another element.

The enclosing element is often referred to as the "parent," while the enclosed element is called the "child."

Nested HTML Element = One HTML Element Inside Another HTML Element

For example:

app/page.tsx
1<h1>
2   <b>This is our first heading</b>
3</h1>

In this example, the <b> element (child) is nested inside the <h1> element (parent).

What is an Empty HTML Element?

An empty HTML element is one that does not have a closing tag or content. These elements are also known as "void elements" or "self-closing elements."

Empty HTML Element = Tags with No Content

For example:

app/page.tsx
1</br>

This is a break tag, which has no content and no closing tag. It's used to insert a line break within text or other inline elements. The <hr/>tag, used for horizontal rules, is another example of an empty or void element.