Advertisement
❮ Previous: <link> Next: <map> ❯

<main>

HTML <main> Tag

Example

<main>
  <h1>The main element</h1>
  <article>
    <h2>Heading</h2>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit...</p>
  </article>
  <section>
    <h2>Heading</h2>
    <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit...</p>
  </section>
</main>

Try this code ❯

Meaning

Represents the main content of the body of a document or application.

**Note:**There must not be more than one <main> element in a document, and it must not be a descendent of an <article>, <aside>, <footer>, <header>, or <nav> element.

Version: HTML5


Standard Syntax

<main>...</main>


Advertisement

Global Attributes

<main> element also supports the Global Attributes in HTML.


Event Attributes

<main> element also supports the Event Attributes in HTML.


By Default CSS Value(s)

Most of the browsers will display the <main> element with the following by default value(s)

main {
  display: block;
}

Related Tags:

<body>,
<nav>,
<article>,
<aside>,
<h1> - <h6>,
<hgroup>,
<footer>,
<section> and
<header>

❮ Previous: <link> Next: <map> ❯
Advertisement