HTML Elements

An element in an HTML document can be understood as an individual component of an HTML file. In more simple words, the elements are everything written within tags, including the tags, attributes, and contents.

The basic elements used in HTML are:

Headings

<h1> ...... <h6>Content</h1> ...... </h6>

They are used to specify the headings of the page.

Paragraph

<p>Content</p>

It is used to specify content as a paragraph.

Section

<div>Content</div>

It is used to specify a section on the web page.

Line Break

<br>

It is used to specify a line break.

Horizontal Line

<hr>

It is used to specify a horizontal line.

Example:

<!DOCTYPE>  
<html>  
<head>  
<title>Example</title>  
</head>  
<body>  
<h1 style="color: red">Hello</h1>  
<p style="color: blue">World!!</p>  
</body>  
</html>

Void Elements:

Elements with no contents and end tags are called Void or empty elements.

Nested HTML Elements:

An element containing another element is called the Nested HTML Element.

Block-level element:

An element that structures the main part of the web page is the Block-level element. It divides a page into coherent blocks and takes the full width of the web page, from left to right. It always starts with a new line.

The block-level elements in HTML are:

<address>, <article>, <aside>, <blockquote>, <canvas>, <dd>, 
<div>, <dl>, <dt>, <fieldset>, <figcaption>, <figure>, <footer>, 
<form>, <h1>-<h6>, <header>, <hr>, <li>, <main>, <nav>, <noscript>, 
<ol>, <output>, <p>, <pre>, <section>, <table>, <tfoot>, <ul>, <video>