Home / Learn HTML / HTML Form Elements
HTML Form Elements
Besides input there are other form elements: select, textarea, button, datalist, output, progress, meter.
Definition
Besides input a form uses other elements: label names a control, select with option and optgroup makes a drop down, textarea a multi line box, button a button, datalist a list of suggestions, fieldset with legend groups controls, output shows a result and progress and meter show bars.
<label for="x"> and <input id="x">. Clicking the label then focuses the input.Theory in plain words
What it is
Form elements include select, textarea, label, fieldset, datalist, progress and meter, in addition to input and button.
Why we use it
Different data needs different controls: a list of options, a long message, a group of radio buttons.
How it works
Each control sends its name and value on submit. label and fieldset connect and group them for accessibility.
Where it is used
- Country dropdown with select
- Message box with textarea
- Radio groups inside fieldset
Hold Ctrl (or Cmd) to pick more than one.
Meter shows a measured value, progress shows how far a task has gone.
Quick quiz
1. Which tag makes a drop down?
select with option.
2. Which holds many lines of text?
textarea is multi line.
3. Which tag shows task progress?
meter is for measurements.
Common questions
Which tag makes a drop down?
<select>. select with option.
Which holds many lines of text?
<textarea>. textarea is multi line.
Which tag shows task progress?
<progress>. meter is for measurements.