6 Form Related HTML Tags You Might not Know

HTML5 added a lot of new tags. Let's discover a few not that well known

10 July,2021

post-image

HTML5 achieved W3C recommendation in 2014 and added a lot of new tags. Some of them like <main>,<nav>, <header> or <footer> are semantic replacements for common used <div>. Everybody was talking about those tags, but there a lot of different not so often used and not known. Let's discover together 6 form related HTML elements you might know. @Albert Wallicki.

Progress bar

When you create a form and there is a file upload input, you should show how much of file was uploaded. This is a big UX (user experience) improvement. Your first thought might be:

And that's OK. But we have special HTML tag to display progress indicator! <progress> was added with other HTML5 elements. Let's take a look at it.

post-image

Unique Attributes

This element includes two attributes:

Datalist

The <datalist> element was created to be used as a recommendation list for inputs. You can choose available options or type your own answer. This element is used by browsers to provide autocomplete feature.

post-image

The <datalist > is an invisible helper for your inputs. You might dynamically add options to it, making it personalized for each user of your app.

Usage

The only thing that you have to remember about The < datalist > is that its id must be equal to the input element list attribute. This allows the browser to know that this < datalist > belongs to <input >

Fieldset and Legend

The < fielset > element groups several inputs within one form and the <legend> element groups related elements. Think about it as a < label >

post-image

Both elements can be used together to group part of the form (< fielset >) and to add global label to it (<legend>).

Output

The output element is one of my favourite not-well-known HTML tags. This element can inject the results of user calculations. In my example, we have two inputs type number and one type range. Math pattern look like this: (a * b) + c = d;

post-image

Optgroup

This HTML tag allows us to group select options. For example, if you have a country select, you can group it by continent.

post-image

Contact Me :

social-media icon social-media icon social-media icon social-media icon social-media icon social-media icon social-media icon social-media icon