A Simple Guide on Main Tags in HTML

 A Simple Guide on Main Tags in HTML




What is a main tag

A main tag in html is a tag that has a unique and important content for that particular html page or document and it should not be an information that is repeated across all other pages of the document. It is also not supposed to be the child element of a header, article, footer, nav, aside of a html page. Another important point to consider and note here is that the html document should not by any means have more than one main tag.

Code Syntax

<main>
    // some content to do with the main tag put here
</main> 

Example Code for using a main tag

Given below is a code block to understand the main tag usage in an html document. As you can understand here, you cannot use this content between the main tags in any other page of the html document as this is the main information provided inside the main tag and cannot be repeated across the other pages of the document.


  
  
<main>
<h1>Coding For Beginners</h1> <p>Welcome to my coding blog! In this blog, you will learn coding tips while learning web development for beginners.</p> <h2>Chapter 1: Introduction to Coding</h2> <article> <h3>Some Coding Tips?</h3> <p>You will learn how to code like a pro without breaking your brain. You will also get to practise some tricks on practising coding projects while building several projects for beginners, without breaking your back!</p> </article> <h2>Chapter 2: Getting Started with Web Development</h2> <article> <h3>What to learn for web development</h3> <p>To learn web development, you need to learn html, css, javascript, node.js and
also python to cover the full stack web development certification program.</p> </article> </main>

Conclusion

With the above example code and explanation, it must be clear what a main tag is and what importance it holds in an html document. It is a semantic tag that is non-repeatable and unique in a html docuent as it holds the main informational content of the document . In the next post, I will be coming with more tags and elements in HTML documents. Until then, happy coding!

Comments

Popular Posts

Build A Random Quote Machine in React

Welcome to my first Blog Post

A Simple Guide to Promises in JavaScript ES6

Beginner's Guide On For Loop in Python

Top Free Online Websites to Learn Coding

Build A Calculator in React

How to remember code in your learning phase