You may be familiar with the most common HTML tags like p, a, and img, but what about progress or details? HTML is a lot more expressive than you might have realized, and the following tags pack plenty of functionality.
Find out what each of these hidden gems can be used for and why they’re so important.
HTML has supported multimedia elements—images, video, audio—for many decades, but the latter two required to work. Thankfully, HTML5 brought native audio and video elements to the web, and implementations have been improving ever since.
A simple, clear person with the controls you’d hope is the audio component of today, including a play/pause key, timing details, and an interactive progress bar. This person may be styled to some degree, giving it a full-width element, for instance.
The app may change depending on the web browser. For instance, Chrome has a size and quiet control. However, this tag offers a trivial way to support sound recording across browsers, with customizable features to revers its behavior.
HTML is a descriptive markup language that cares more about the meaning of a piece of information than how it appears in a computer. CSS is available for aesthetic purposes, but even that language can render quite differently depending on the device.
If you’re working on a component that demands pixel precision, however, the canvas element is for you. Using canvas, you can write text on the page in an exact font and draw graphics with certainty.
This doesn’t mean you should reach for canvas all the time, though; it’s not a good replacement for the real content on your pages. But if you’re building a game or a highly-tailored interface for a narrow use, canvas can be an effective means of doing so.
When you right-click a cloth factor in your computer, you can choose to save it as an image.
By providing a list of suggested ideals to choose from, this mysterious element can extend some input types. For instance, when you pair a text input with an input, you can automatically complete the code simply by declaring the set of true options:
You can then connect an input element with this list using its id:
It doesn’t stop there, though; datalist works with other types of elements. It pairs well with color inputs, where browsers can offer a palette of preferred colors:
datalistAid varies between different browsers, so make sure you thoroughly examine it. Luckily, unsupported, this component should smoothly decline.
The details element is possibly the clearest example of a highly-functional HTML element that many people overlook or simply don’t know about. It can be highly effective when used on its own, and can even replace JavaScript code to produce a modern component when paired with CSS.
detailscreates a reporting app that the reader can change the display or hiding of in your content. These can even expected more complicated tabbed interfaces, making them great for quizzes and other supplementary information.
This label is simple to use in its purest form:
Hello, world!
You can also pair it with a summary element to customize the legend at the top of the widget:
...
Content goes here...
This element has been around for a while, and its simplicity may lead you to think it’s not that useful, but that’s far from the case. You can use the mark element to call attention to a specific piece of text that is otherwise semantically identical to the text that surrounds it.
The default browser style usually renders the mark element with a yellow background:
This nods to the highlighter pen tone, which implies highlighting a range of text as particularly significant or pertinent in a particular context.
One of the best uses for mark is to highlight search results. You can also use it to call out content that has been commented on or highlight differences between one piece of text and another.
The ones that accomplishes a bit with tiny are what I like best. They take existing requirements that have been satisfied by numerous Browser implementations and turn them into standard, steady, and trustworthy HTML.
progressis a good illustration. To show the implementation status of a task, this tag creates a styleable, scriptable progress bar:
With a floating point value between 0 and 1, development can be used:
Or you can give a maximal and a price for it, as needed:
Without any significance, you may discover that your computer animates the improvement bar to show ongoing activity without a recognized status.
The picture tag is just a modern equivalent of img, right? Not quite: picture has a lot more to offer, most of it under .
Although the outcomes may appear the same as an image, the tag focuses solely on the destination’s appearance. Using a portrait, you can choose an image based on the following:
- Format, which means you can support a wider variety of tools.
- File size is used to enhance performance and reduce bandwidth usage by people.
- format, so you can adapt your style to the size of the screen.
This is all accomplished using a structure that allows for multiple photo options in place of just one:
![Use these 8 local HTML tags in place of the over-coding on your website. 22]()
Details about a candidate picture are provided for each supply element, as well as descriptions of appropriate use times. The international element is also present, but it’s used as a fallback in the event that an appropriate source can’t be identified.
Using picture does involve a bit more work than a single img, but it’s a lot easier than trying to maintain separate entire websites for each use.
I’ll come to an innovative label that relies on JavaScript but has the potential to significantly simplify the process of working with dynamic content.
A model factor defines html that, as its name suggests, can be used to easily create new html. Template parts are a part of the DOM and can be used to create elements that will appear, but by definition they won’t show up.
Without template, adding content to the DOM requires either a lot of code (using createElement, createTextNode, appendChild, and similar methods) or a lot of string processing, with innerHTML, which can be insecure if you’re not careful. Using template, you can define a chunk of markup like this:
You can then replicate that content with a simple call to clone and add it to the DOM using importNode. This is much less work than the alternative:
const clone = document.importNode(template.content, true);tbody.appendChild(clone);