Published Jan 16, 2022
Contribute to Docs

The <main> semantic tag represents the primary content within the <body> of the web page. This excludes content from other structural elements such as the header or footer.


The <main> can be placed anywhere inside of the <body>:

    <!-- Main content goes here. -->


Below is an example of the <main> tag being used to display a list of notable lines from works by Shakespeare:

<!DOCTYPE html>
<head> </head>
<h1>My Favorite Shakespeare Lines</h1>
<li>"To be, or not to be: that is the question." - Hamlet</li>
"Friends, Romans, countrymen, lend me your ears!" - Julius Caesar
"Shall I compare thee to a summer’s day? Thou art more lovely and more
temperate." - Sonnet 1
<a href="https://en.wikipedia.org/wiki/William_Shakespeare">
Learn more about William Shakespeare

All contributors

Looking to contribute?

Learn HTML on Codecademy