agyanadda@gmail.com

HTML Form Elements

HTML Forms 1 min read Updated Nov 30, 2026 Topic 24 of 33

Besides <input>, forms use several other elements.

  • <label> — the text for a field. Connect it with for="id" so clicking the label focuses the field.
  • <select> with <option> — a dropdown list.
  • <textarea> — a multi-line text box.
  • <button> — a clickable button (type="submit" sends the form).
  • <fieldset> and <legend> — group related fields with a title.

Example

Example — A complete enquiry form HTML
<form>
  <fieldset>
    <legend>Course enquiry</legend>

    <label for="name">Name</label><br>
    <input id="name" name="name" type="text"><br><br>

    <label for="course">Course</label><br>
    <select id="course" name="course">
      <option>Web Designing</option>
      <option>PHP &amp; Laravel</option>
      <option>Python</option>
    </select><br><br>

    <label for="msg">Message</label><br>
    <textarea id="msg" name="message" rows="4" cols="30"></textarea><br><br>

    <button type="submit">Send</button>
  </fieldset>
</form>

Test Yourself With Exercises

Exercise 1 Multiple Choice

Which element creates a dropdown list?

Exercise 2 Fill in the Blank

A label is linked to an input with the ___ attribute.

Exercise 3 True / False

<textarea> allows multiple lines of text.

Frequently Asked Questions

Clicking the label focuses the field, it makes forms easier on phones, and screen readers read the label for the field.