main element Tag Html Css Learning

 <main> Tag element Html Css Learning


Definition and Usage

The <main> 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.

  

The HTML <main> Tag is used to give the primary information of a document. The content inside the <main> element should be unique for the document. Which includes the sidebars, navigation links, copyright information, site logos, and search forms. 

Note: The document must not contain more than one <main> element. The <main> element should not be a child elements of an <article>, <aside>, <footer>, <header>, or <nav> element. 

Syntax: 

 

<main>

    //contents of main Element 

</main> 


Example:


<!DOCTYPE html>

<html>

<head>

<style>

.class {

color: black;

}

</style>

</head>


<body>

<h1 class="class">&lt;Main&gt; Tag</h1>

<main>

<h1>Programming Languages</h1>

<p>Html programming, Python

Programming, Java Programming</p>


<article>

<h1>Html Programming</h1>

<p>HTML stands for HyperText Markup Language. HTML marks up the content of a site. Basically, it tells the user's computer what things are. It also provides access to an incredible amount of functionality that's already built directly into the browser.</p>

</article>

<article>

<h1>Python Programming</h1>

<p>Python is a computer programming language often used to build websites and software, automate tasks, and conduct data analysis. Python is a general-purpose language, meaning it can be used to create a variety of different programs and isn't specialized for any specific problems</p>

</article>

<article>

<h1>Java Programming</h1>

<p>Java is a programming language and computing platform first released by Sun Microsystems in 1995. It has evolved from humble beginnings to power a large share</p>

</article>

</main>

</body>

</html>



Try it 

CSS <main> tag style the
element


Example:

<style>

main {
  margin: 0;
  padding: 7px;
font-size:20px;
  background-color: gray;
}

</style>

Comments :

Post a Comment