There are 142 HTML tags according to Mozilla Developer Network(MDN) and usually we are using few of them only, few of them we might not heard about. We are mostly rely on libraries to achieve different functionality which will increase our bundle size. so there are lot of functionality can be achieved using these HTML Tags which we are not aware of.
Here are few tags and there use cases -
Accordion
Sometimes we might want to hide some content and allow users to reveal it manually, we can a achieve the described functionality with pure HTML.
Thanks to HTML5, HTML5 introduced the details and summary tags that can be used to create a pure HTML accordion
<details>
<summary>What is Accordion?</summary>
<p>The accordion is a UI paradigm that consists of several stacked blocks. Each block consists of a label and a content section, clicking on a label either expands or collapses the section.</p>
The blockquote tag specifies a section that is quoted from another source.
It is useful when we want to highlight some part of our articles.
<blockquote>“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” – Martin Fowler</blockquote>
blockquote{
background:#f9f9f9;
border-left:10px solid #0035ff;
margin:1.5em10px;
padding:0.5em10px;
}
blockquote:before{
color:#ccc;
content: open-quote;
font-size:4em;
line-height:0.1em;
margin-right:0.25em;
vertical-align:-0.4em;
}
Date Picker
HTML provides a input type="date" tag, that provides a nice UI with the option to select the dates by clicking on it.
The contenteditable attribute specifies whether the content of an element is editable or not.
<elementcontenteditable="true|false">
<pcontenteditable="true">This is editable. Try to change this text.</p>
<pcontenteditable="false">This is not editable.</p>
<divcontenteditable="true">This div content is editable.</p>
body{font-size:1.2rem;}
Progress Bar
To show progress bar you can use The progress tag.
Here is an example to do that -
<progressmax="100"value="80"></progress>
progress[value]{
width:350px;
height:60px;
}
Dropdown
To create dropdown we can use select tag and datalist html tag.
The difference between these two is when we use select we have to list all the options using option tag while if we do using datalist then we have to use input where we can enter our own input as well.
<div>
<labelfor="select">Select Browser:</label><br/>
<selectid="select"name="browser">
<optionvalue="firefox">Firefox</option>
<optionvalue="ie">IE</option>
<optionvalue="chrome">Chrome</option>
<optionvalue="opera">Opera</option>
<optionvalue="safari">Safari</option>
</select></div>
<br/>
<div>
<labelfor="datalist">Select or Enter Browser :</label><br/>
<inputid="datalist"placeholder="Select or Enter Browser"type="text"list="browsers">
<datalistid="browsers">
<optionvalue="Firefox">
<optionvalue="IE">
<optionvalue="Chrome">
<optionvalue="Opera">
<optionvalue="Safari">
</datalist></div>
Tooltip
Tooltip is used to show extra or detailed information about any element.
We can use HTML built-in title attribute for that.
<buttontype="button"title="Tooltip is used to show extra or detailed information about any element">What is tooltip?</button>