What is the main element in HTML?

The <main> tag is used to specify the dominant content of a document. It consists of the content that is directly related to the central topic. Redundant content such as sidebars, navigation links, and search forms are avoided under the <main> tag. In addition, a document must not contain more than one <main> element.

<main> does not contribute to the structure of the document like elements such as <h1> (Heading) or <body> does. Therefore, its usage is strictly informative and does not affect the DOM’s concept of the page’s structure.

Example

An example of how the <main> tag can be used in an HTML document is as follows:

Copyright ©2024 Educative, Inc. All rights reserved