Hidden HTML Gems: Take your HTML game to the next level with these 8 lesser-known HTML tags!

Portrait photo of person in bright red turtleneck sweater against a yellow backdrop.

Zoey Frisart

Written by


Published


Topics

  • Dev

When it comes to web development, we often find ourselves falling into the comfy embrace of well-known HTML tags like <div>, <p>, and <a>. But what if I told you there's a dazzling world of lesser-known HTML elements that can make your life easier, your code cleaner, and your websites more user-friendly?

Buckle up as we embark on a journey through eight fantastic HTML elements - <dialog>, <meter>, <details>, <datalist>, <output>, <time>, <kbd>, and <optgroup>. We'll unravel their hidden superpowers, explain why they're cooler than custom JavaScript, and, of course, dish out some juicy limitations.

 

<dialog>: Bye-bye Clunky Modals!

<dialog> simplifies the creation of modal dialogues, those handy pop-ups that often require intricate JavaScript and CSS. It encapsulates modal content and behaviour, making them easy to manage.

Usage:

With the <dialog> element custom modals become a relic of the past, it greatly simplifies the creation of modals. The <dialog> element is accessible by default and implements the best practices related to modals. 

Note: Beware of browser support limitations; this feature has been adopted by all major browsers since 2022, if you need to support older versions consider using a polyfill.

 <meter>: Show Off Your Data!

<meter> is your go-to element for creating visually appealing progress bars. It's perfect for showcasing data within a defined range, like ratings. It is very similar to the progress element, the difference between them being that the meter is used to display a score, while progress is used to display the progress of a task.

Usage:

With <meter>, you can create progress bars that are visually stunning and informative. Plus, it's a breeze to set up and customize.

Note: Some browsers might have different default styling on the progress elements. As such, it is best to ensure a good CSS reset on the meter style before applying custom styling.

<details>: Expandable Content Magic

<details> is the magician behind expandable content sections. It reduces clutter and improves user experience by letting users toggle content visibility.

Usage:

With the <details> element, you can easily create collapsible sections, making complex logic for FAQ sections a thing of the past. The details element is accessible and SEO-friendly by default. It greatly simplifies the creation of collapsible sections.

Note: Sadly, the <details> element is not perfect. Some older browsers might not support the element. In addition, animation of the details element takes a lot of work to achieve. If motion is an important aspect of your collapsible, consider using a custom expandable element.

<datalist>: Auto-Suggest Your Way to User Happiness

<datalist> provides a list of predefined options or suggestions for input fields, making user input more efficient and error-free.

Usage:

<datalist> improves user experience by providing handy auto-suggestions, reducing input errors, and making your forms shine. The <datalist> is a great option when the <select> element does not fulfill your needs.

Note: Styling options are limited, and not all browsers play nice with it.

 <output>: Display Calculations with Ease

<output> is your ally for displaying the results of calculations or user interactions. It simplifies dynamic data presentation. It’s also a nice way to display toasts to a user if it results from a user interaction.

Usage:

<output> simplifies dynamic data presentation without the need for complex JavaScript maneuvers. It also has improved accessibility since it automatically announces the results to screen readers when it changes.

<time>: Dates, Times, and Durations, Oh My!

<time> is versatile, marking up dates, times, and durations in a machine-readable format, enhancing SEO and accessibility.

Usage:

<time> is a Swiss Army knife for marking up dates, times, and durations, ensuring consistency and accessibility. It is a great way to provide additional information about a time or date.

 <kbd>: Speak Keyboard with Style

<kbd> is perfect for indicating keyboard input within your content, making it more user-friendly and visually appealing.

Usage:

Using <kbd> makes it easier to understand keyboard shortcuts, it is a great element when you are creating documentation or in a settings screen where users can change their keyboard shortcuts. By making it semantic, you also make it more accessible.

<optgroup>: Organize Select Menus Like a Pro

<optgroup> is used to group related options within a <select> dropdown, making your choices more manageable and organized.

Usage:

Correctly using <optgroup> simplifies complex select menus, making your choices more manageable and organized.

These HTML gems are your secret weapons in a world of web development possibilities. They'll simplify your code, amp up your user experience, and save you from custom JavaScript headaches. Sure, they have their quirks and limitations, but the benefits far outweigh the downsides. We look forward to hearing from you — whether you’re a senior dev or are just getting started with web development. Have you stumbled across some unique HTML tag that transformed your project?


Make your project our next obsession.

Let’s talk

We can't wait to talk about your ideas, goals, needs and dreams. Let's set up a call.

Start a project