HTML Tags You Might Not Have Heard Of.
Especially if you’re just learning.
HTML is around for quite some time, and it might seem easy to learn all relevant tags, you might be surprised. There are many tags that are outdated, and many tags that are new in HTML5. Let’s take a quick look at some of these tags that you could still use.
ABBR
The <abbr>
tag is used for abbreviations and letting the user know what it means when they hover over it. This is not used very often but it can be helpful if you’re using lesser-known abbreviations or just a lot of similar abbreviations.
When the user hovers over it it will show a default unstyled tooltip with whatever is put into the title
attribute.
KBD
The <kbd>
tag is used for showing users the keyboard buttons they need to press for certain actions. It is styled similar to <code>
on most browsers. This specific tag might be useful for adding styles without the use of classes. It doesn’t need any attributes so if you’re not keen on adding this tag you can achieve the same with a <span>
tag.
SAMP
The <samp>
tag is commonly used to show a sample output of a program. It is similar in style to <kbd>
and <code>
. This tag is also handy if you want to style on tags rather than classes. It doesn’t require any attributes.
DETAILS
The <details>
tag is used for creating an accordion element in HTML. It is often done with <div>
tags instead of the <details>
tag. Inside the tag, you put the content to show when the accordion is opened. The <summary>
tag is used inside the <details>
to change the title of the accordion, or the content you see when it is closed.
To open and close the element, simply click it as you would expect.
Conclusion
If you’ve ever browsed W3Schools or Mozilla, you might know there are many more tags with very niche functions. Should you use these though? I think that some effects are better off done in CSS and JavaScript, but for readability, it might be great to use some of these. Just be sure that they’re not getting deprecated anytime soon.
Thank you very much for reading and have a wonderful day.