I have a lot of confusion around main
tag of HTML. It describes content of the page but so does body
. There should be only one main
tag in the page. The body
tag should also have one appearance in HTML. What is the difference between these two tags ? Which elements can be nested between main
tag and which can't? How does this tag change it's nature to flow content and palpable content ?
Differences between main and body:
main:
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.
body:
The body element contains all the contents of an HTML document, such as text, hyperlinks, images, tables, lists, etc.
An easy example, the footer element; you should put it inside the body, but outside the main, as you will do with your menu, or sidebar.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With