main: The Main element
The <main>
HTML element represents the dominant content of the <body>
of a document. The main content area consists of content that is directly related to or expands upon the central topic of a document, or the central functionality of an application.
Attributes
Global attributes
accesskey
Specifies a keyboard shortcut to activate or focus an element.
aria-*
Defines accessibility properties and states for assistive technologies.
class
Specifies one or more CSS class names for styling the element.
data-*
Stores custom data private to the page or application.
dir
Sets the text direction (left-to-right, right-to-left, or auto).
hidden
Hides the element from display and assistive technologies.
id
Defines a unique identifier for the element within the document.
inputmode
Hints which virtual keyboard type to display on mobile devices.
itemid
Provides a global identifier for microdata items.
itemprop
Defines a property name-value pair for microdata.
itemref
Associates properties with an item via element IDs for microdata.
itemscope
Creates a new microdata item container.
itemtype
Specifies the vocabulary URL for microdata items (like Schema.org).
lang
Specifies the primary language of the element’s content.
nonce
Provides a cryptographic nonce for Content Security Policy.
role
Defines the element’s semantic role for accessibility.
tabindex
Controls keyboard navigation order and focusability.
title
Provides advisory information displayed as a tooltip.
Example
<body>
<header>
<h1>My Personal Website</h1>
<nav><!-- navigation links --></nav>
</header>
<main>
<h2>Welcome to My Corner of the Web</h2>
<p>This is where I share my thoughts about web development, the IndieWeb, and building sustainable online communities.</p>
<section>
<h3>Recent Posts</h3>
<!-- blog posts content -->
</section>
</main>
<footer><!-- footer content --></footer>
</body>