10 Jul HTML5 main Tag
As the name tells, the HTML5 main tag allows you to specify the key content of a document. Whatever you write under the <main> tag should be unique. It shouldn’t include the content which is included and repeated on every page, such as copyright information, logo, sidebars, etc.
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
<!DOCTYPE html> <html> <head> <title>Understanding HTML5 Main tag</title> </head> <body> <main> <h1>World Sports</h1> <p>Football and Cricket are the 2 most popular team sports in the world.</p> <article> <h1>Football</h1> <p>Football is quite popular in Brazil, Argentina, Germany and many other countries.</p> </article> <article> <h1>Cricket</h1> <p>Invented in England, Cricket now have more than 10 official teams.</p> </article> </main> </body> </html> |
Here’s the output, we’re printing the content for World Sports here with headings Football and Cricket under the <article> element. All the content is our key content, so we added under the HTML5 <main> element,
No Comments