HTML Elements

The start tag, certain contents, and the end tag define an HTML element.


HTML Elements

Everything from the start tag to the end tag is considered an HTML element:

<tagname>Content follow here...</tagname>

Examples of some HTML elements:

<h2>Your First Heading</h2> <p>Your first paragraph.</p>

Start tag Element content End tag
<h1> My First Heading </h1>
<p> My first paragraph. </p>
<br> none none

Note: Some HTML items contain no content (such as br). These elements are known as vacuum elements. There is no end tag for empty items!

It is used for html element list, html elements and attributes, elements with no content are called, html elements are positioned dash by default, and tags different.

Nested HTML Elements

HTML components may be nested, which means they may be stacked on top of each other (this means that elements can contain other elements).

Nested HTML elements may be found in any HTML document.

Four HTML elements (<html>, <body>, <h1> and <p>) are used in the example below:

Example

<!DOCTYPE html>
<html>
<body>

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

</body>
</html>

Result of the above query

Your First Heading

Your first paragraph.

Example Explained

The root element is the html tag, which defines the whole HTML page.

There is a htmlstart tag and a /html end tag.

Then, there is an element body within the html element:

<h2>Your First Heading</h2>
<p>Your first paragraph.</p>

The element body specifies the body of the document.

It has a body tag at the beginning and a /body tag at the conclusion.

Then there are two more components inside the body element: h1 and p:

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

A heading is defined using the h1 element.

It has a h1beginning tag and /h1ending tag:

<h2>Your First Heading</h2>

A paragraph is indicated with thepelement.

It has a pstart tag and a/p end tag:

<p>Your first paragraph.</p>
It is used for nested html elements example, meaning, explain, and clickable elements, nested list elements, get, xpath, and select element html.

Never Skip the End Tag

Even if you forget the end tag, certain HTML components will show correctly:

Example

<html>
<body>

<p>This text is a <b>paragraph</p>
<p>This text is a paragraph</p>

</body>
</html>

In the example above, we did not close the end tag </b>.

Result of the above query

This text is a paragraph

This text is a paragraph

However, you should never rely on this! If you neglect to include the end tag, you may receive unexpected results and problems!

Empty HTML Elements

HTML elements that have no content are referred to as empty elements.

The tag br denotes a line break and is a blank element that has no closing tag:

Example

<p>It is a <br/>paragraph with a line break.</p>

Result of the above query

It is a
paragraph with a line break.

It is used for html empty elements examples, close empty, remove empty, empty space, and empty list, what is empty elements in html mcq.

HTML is Not Case Sensitive

The case of HTML tags is unimportant: P is the same as p.

Although lowercase tags are not required by the HTML standard, the recommends them in HTML and requires them in stricter document types like XHTML.

It is used for html is not case sensitive language true or false, and explain, like html xhtml is not case sensitive.