HTML - tags - main tag

revision:


Content

"main" tag : specifies the main content of a document syntax some examples


"main" tag : specifies the main content of a document

top

The <main> tag - a semantic tag - specifies the main content of a document. The content inside the <main> element should be unique to the document. It should not contain any content that is repeated across documents such as sidebars, navigation links, copyright information, site logos, and search forms.
There must not be more than one "main" element in a document. The "main" element must NOT be a descendant of an "article", "aside", "footer", "header", or "nav" element.

The <main> tag doesn't contribute to the document's outline. Unlike elements such as <body>, headings such as <h2>, etc., <main> doesn't affect the DOM's concept of the structure of the page. It's strictly informative.

Attributes: the <main> element supports the global attributes and events attributes.


syntax

top

<main> . . . </main>


some examples

Gecko facts

Geckos are a group of usually small, usually nocturnal lizards. They are found on every continent except Australia.

Many species of gecko have adhesive toe pads which enable them to climb walls and even windows.

Codes:

                    <header style="margin-left:4vw;">Gecko facts</header>
                    <main style="margin-left:4vw;">
                        <p class="spec">Geckos are a group of usually small, usually nocturnal lizards.
                        They are found on every continent except Australia.</p>
                        <p class="spec">Many species of gecko have adhesive toe pads which enable them
                        to climb walls and even windows.</p>
                    </main>
                

Apples

The apple is the pomaceous fruit of the apple tree.

Red Delicious

These bright red apples are the most common found in many supermarkets.

...

...

Granny Smith

These juicy, green apples make a great filling for apple pies.

...

...

Codes:

                    <main style="margin-left:4vw;">
                        <h3>Apples</h3>
                        <p class="spec">The apple is the pomaceous fruit of the apple tree.</p>
                        <article style="margin-left:2vw;">
                        <h4>Red Delicious</h4>
                        <p class="spec">These bright red apples are the most common found in 
                        many supermarkets.</p>
                        <p class="spec">... </p>
                        <p class="spec">... </p>
                        </article>
                    
                        <article  style="margin-left:2vw;">
                        <h4>Granny Smith</h4>
                        <p class="spec">These juicy, green apples make a great filling for apple
                        pies.</p>
                        <p class="spec">... </p>
                        <p  class="spec">... </p>
                        </article>
                    </main>