details tag in HTML5

The <details> tag in HTML5 is used to show the details of the particular topic.

<html>
<body>
<details>
<summary>C# Corner</summary>
<p>Premier community for C#, ASP.NET, Silverlight, WPF, Windows Phone, Windows Forms and .NET tutorials, articles, blogs, forums, news, and resources.</p>
</details>
</body>
</html>

Here we take a Summary tag. It is used to specify a visible heading for the details.

OUTPUT

1.png

After we click on it:


2.png


New feature in HTML5:

HTML5 introduces open attribute in the details tag. This property is used when we want that the details of the content is always visible to us.


<html>
<body>
<details open="open">
<summary>C# Corner</summary>
<p>Premier community for C#, ASP.NET, Silverlight, WPF, Windows Phone, Windows Forms and .NET tutorials, articles, blogs, forums, news, and resources.</p>
</details>
</body>
</html>


OUTPUT:


2.png2.png
Ebook Download
View all
Learn
View all