HTML <main> Tag
The HTML <main> Tag defines a document’s main content, which should be unique. It excludes content like sidebars, navigation, logos, and copyright info, ensuring unique document-specific material within.
Note: The document must not contain more than one <main> element. The <main> element should not be a child element of an <article>, <aside>, <footer>, <header>, or <nav> element.
Syntax:
<main>
// contents of main Element
</main>
HTML <main> Tag Examples
Example: In this example, we are using the <main> tag. It encapsulates main content, including headings and articles, conforming to HTML5 semantics.
<!DOCTYPE html>
<html>
<head>
<title>The <Main> Tag</title>
</head>
<body>
<h1>The <Main> Tag</h1>
<main>
<h1>Programming Languages</h1>
<p>c programming, C++
Programming, Java Programming</p>
<article>
<h1>C Programming</h1>
<p>C is a Procedural language</p>
</article>
<article>
<h1>C++ Programming</h1>
<p>C++ programming is a
Object oriented Programming.</p>
</article>
<article>
<h1>Java Programming</h1>
<p>Java is a pure Object
oriented Programming.</p>
</article>
</main>
</body>
</html>
Output:
Supported Browsers: The browsers supported by <main> Tag are listed below:
Contact Us