An HTML element is defined by a start tag, some content, and an end tag.
HTML elements are the basic building blocks of HTML documents that define the structure and content of web pages. Each element consists of an opening tag, a closing tag, and the content in between. The opening tag is enclosed in angle brackets and specifies the name of the element, while the closing tag is also enclosed in angle brackets and includes a forward slash (/) before the element name to indicate the end of the content.
<tagname>Content goes here...</tagname>
Examples of some HTML elements:
<h1>My First Heading</h1>
<p>My first paragraph.</p>

Note:- Some HTML elements have no content (like the <br> element). These elements are called empty elements. Empty elements do not have an end tag!
Nested HTML Elements:-
HTML elements can be nested (this means that elements can contain other elements).All HTML documents consist of nested HTML elements.
Nested HTML elements refer to the practice of placing HTML tags within other HTML tags. This allows developers to create complex and structured web pages that can include a variety of content types, such as images, videos, text, and interactive elements.
Nested HTML elements can be used for a variety of purposes, including creating more advanced layouts, organizing content hierarchically, and adding functionality to web pages. For example, developers can use nested elements to create a menu bar with dropdown options, or to display a series of images within a gallery.
To nest HTML elements, developers simply need to enclose the inner element within the opening and closing tags of the outer element. For example, to nest an image within a paragraph, the image tag would be placed within the paragraph tag:
<p>This is some text <img src="example.jpg" alt="example image"> </p>
It's important to note that nested elements must be properly closed in the correct order to ensure the code is valid and functions as intended. Developers can use a variety of tools and resources to check the validity of their HTML code and identify any errors or issues.
Overall, nested HTML elements offer a powerful way to create dynamic and interactive web pages with a wide range of content types and functionality. By mastering the basics of HTML nesting, developers can create more engaging and effective web pages that meet the needs of their users.
The following example contains four HTML elements (<html>, <body>, <h1> and <p>):

Example Explained:-
The <html> element is the root element and it defines the whole HTML document.
The HTML (Hypertext Markup Language) is the standard language used to create and structure web pages. Every HTML document begins with an <html> element, which is also referred to as the root element. This element serves as the container for all the other HTML elements, such as <head>, <body>, <title>, <header>, <footer>, <article>, <section>, etc.
The <html> element defines the document type and the version of HTML being used. For example, the document type declaration for HTML5 is <!DOCTYPE html>. This element also contains the language attribute, which specifies the language used in the document.
The <head> element, which is a child of the <html> element, contains meta data about the document, such as the title, author, description, keywords, and other information that is not displayed on the web page itself. The <body> element, which is also a child of the <html> element, contains all the visible content of the web page, such as text, images, links, videos, and other multimedia.
Read More:- HTML Basic
In summary, the <html> element serves as the foundation of an HTML document and defines the overall structure of the web page. All other HTML elements are nested within the <html> element, and it is essential to include this element in every HTML document. Without the <html> element, the web browser would not be able to understand the content of the web page, and it would not be displayed correctly.
It has a start tag <html> and an end tag </html>.
Then, inside the <html> element there is a <body> element:

Body:-
The <body> element defines the document's body.The <body> element is a crucial part of any HTML document. It defines the main content area of the webpage, where all the visible content is displayed. All the text, images, videos, links, and other elements that make up the webpage are contained within the <body> tag.
The <body> tag is usually placed after the <head> tag in the HTML document, and it can include various other tags and attributes to define the layout and style of the content. For example, you can use <div> tags to group related elements together, <p> tags to define paragraphs of text, <img> tags to display images, and <a> tags to create hyperlinks.
In short, the <body> element is essential for creating the visible content of a webpage and provides the canvas on which developers can build their website.
It has a start tag <body> and an end tag </body>.
Then, inside the <body> element there are two other elements: <h1> and <p>:

Heading:-
The <h1> element in HTML is used to define the main heading of a webpage. It is typically the largest and most prominent heading on the page, and it is used to introduce the main topic or theme of the content.When using the <h1> element, it is important to remember that it should be used only once per page, and it should be used for the main heading or title of the content. Subheadings and other headings should be marked up using the <h2>, <h3>, and other heading elements, depending on the hierarchy of the content.
The <h1> element is important for both SEO and accessibility purposes. Search engines use the <h1> element to understand the main topic of the content, and screen readers use it to announce the main heading of the page to visually impaired users.
It is also important to use proper heading hierarchy and to not skip any levels, as this can confuse both search engines and users. For example, if you skip from an <h1> to an <h3> without using an <h2>, it can be difficult for users to understand the hierarchy of the content.
In summary, the <h1> element is a crucial part of HTML markup for defining the main heading of a webpage, and it is important to use it correctly and in conjunction with other heading elements to ensure proper hierarchy and accessibility.
The <h1> element defines a heading.
It has a start tag <h1> and an end tag </h1>

Paragraph:-
In HTML, a Paragraph is a block of text or content that is enclosed between the <p> and </p> tags. The paragraph tag is one of the most commonly used HTML tags, as it allows web developers to create well-structured and readable content for their websites.When writing HTML, it is important to use the paragraph tag to break up long blocks of text into smaller, more manageable chunks. This makes it easier for readers to scan and understand the content, as well as improving the overall readability of the page.
In addition to using the paragraph tag, there are other HTML tags that can be used to format and structure text on a web page. For example, heading tags (<h1>, <h2>, <h3>, etc.) can be used to create headings and subheadings, while list tags (<ul> and <ol>) can be used to create lists of items.
When creating paragraphs in HTML, it is also important to consider the use of white space and line breaks. White space refers to any spaces, tabs, or line breaks between HTML tags, while line breaks specifically refer to the <br> tag, which creates a single line break in the text. By using white space and line breaks effectively, web developers can improve the readability of their content and make it easier for users to navigate their websites.
Overall, paragraphs are a crucial element of HTML, allowing web developers to create well-structured and readable content for their websites. By using the paragraph tag and other HTML tags effectively, web developers can create websites that are visually appealing, easy to navigate, and engaging for their users.
The <p> element defines a paragraph.
It has a start tag <p> and an end tag </p>:

Never Skip the End Tag
Some HTML elements will display correctly, even if you forget the end tag:

However, never rely on this! Unexpected results and errors may occur if you forget the end tag!